<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html lang="en">

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>LCOV - code analysis - /usr/include/boost/optional/optional.hpp</title>
  <link rel="stylesheet" type="text/css" href="../../../../gcov.css">
</head>

<body>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="title">LCOV - code coverage report</td></tr>
    <tr><td class="ruler"><img src="../../../../glass.png" width=3 height=3 alt=""></td></tr>

    <tr>
      <td width="100%">
        <table cellpadding=1 border=0 width="100%">
          <tr>
            <td width="10%" class="headerItem">Current view:</td>
            <td width="35%" class="headerValue"><a href="../../../../index.html">top level</a> - <a href="index.html">usr/include/boost/optional</a> - optional.hpp<span style="font-size: 80%;"> (source / <a href="optional.hpp.func-sort-c.html">functions</a>)</span></td>
            <td width="5%"></td>
            <td width="15%"></td>
            <td width="10%" class="headerCovTableHead">Hit</td>
            <td width="10%" class="headerCovTableHead">Total</td>
            <td width="15%" class="headerCovTableHead">Coverage</td>
          </tr>
          <tr>
            <td class="headerItem">Test:</td>
            <td class="headerValue">code analysis</td>
            <td></td>
            <td class="headerItem">Lines:</td>
            <td class="headerCovTableEntry">0</td>
            <td class="headerCovTableEntry">21</td>
            <td class="headerCovTableEntryLo">0.0 %</td>
          </tr>
          <tr>
            <td class="headerItem">Date:</td>
            <td class="headerValue">2020-09-11 22:25:26</td>
            <td></td>
            <td class="headerItem">Functions:</td>
            <td class="headerCovTableEntry">0</td>
            <td class="headerCovTableEntry">1</td>
            <td class="headerCovTableEntryLo">0.0 %</td>
          </tr>
          <tr>
            <td class="headerItem">Legend:</td>
            <td class="headerValueLeg">            Lines:
            <span class="coverLegendCov">hit</span>
            <span class="coverLegendNoCov">not hit</span>
</td>
            <td></td>
          </tr>
          <tr><td><img src="../../../../glass.png" width=3 height=3 alt=""></td></tr>
        </table>
      </td>
    </tr>

    <tr><td class="ruler"><img src="../../../../glass.png" width=3 height=3 alt=""></td></tr>
  </table>

  <table cellpadding=0 cellspacing=0 border=0>
    <tr>
      <td><br></td>
    </tr>
    <tr>
      <td>
<pre class="sourceHeading">          Line data    Source code</pre>
<pre class="source">
<a name="1"><span class="lineNum">       1 </span>            : // Copyright (C) 2003, 2008 Fernando Luis Cacciola Carballal.</a>
<span class="lineNum">       2 </span>            : // Copyright (C) 2014, 2015 Andrzej Krzemienski.
<span class="lineNum">       3 </span>            : //
<span class="lineNum">       4 </span>            : // Use, modification, and distribution is subject to the Boost Software
<span class="lineNum">       5 </span>            : // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
<span class="lineNum">       6 </span>            : // http://www.boost.org/LICENSE_1_0.txt)
<span class="lineNum">       7 </span>            : //
<span class="lineNum">       8 </span>            : // See http://www.boost.org/libs/optional for documentation.
<span class="lineNum">       9 </span>            : //
<span class="lineNum">      10 </span>            : // You are welcome to contact the author at:
<span class="lineNum">      11 </span>            : //  fernando_cacciola@hotmail.com
<span class="lineNum">      12 </span>            : //
<span class="lineNum">      13 </span>            : // Revisions:
<span class="lineNum">      14 </span>            : // 27 Apr 2008 (improved swap) Fernando Cacciola, Niels Dekker, Thorsten Ottosen
<span class="lineNum">      15 </span>            : // 05 May 2014 (Added move semantics) Andrzej Krzemienski
<span class="lineNum">      16 </span>            : //
<span class="lineNum">      17 </span>            : #ifndef BOOST_OPTIONAL_OPTIONAL_FLC_19NOV2002_HPP
<span class="lineNum">      18 </span>            : #define BOOST_OPTIONAL_OPTIONAL_FLC_19NOV2002_HPP
<span class="lineNum">      19 </span>            : 
<span class="lineNum">      20 </span>            : #include &lt;new&gt;
<span class="lineNum">      21 </span>            : #include &lt;algorithm&gt;
<span class="lineNum">      22 </span>            : #include &lt;iosfwd&gt;
<span class="lineNum">      23 </span>            : 
<span class="lineNum">      24 </span>            : #include &lt;boost/config.hpp&gt;
<span class="lineNum">      25 </span>            : #include &lt;boost/assert.hpp&gt;
<span class="lineNum">      26 </span>            : #include &lt;boost/core/explicit_operator_bool.hpp&gt;
<span class="lineNum">      27 </span>            : #include &lt;boost/optional/bad_optional_access.hpp&gt;
<span class="lineNum">      28 </span>            : #include &lt;boost/static_assert.hpp&gt;
<span class="lineNum">      29 </span>            : #include &lt;boost/throw_exception.hpp&gt;
<span class="lineNum">      30 </span>            : #include &lt;boost/type.hpp&gt;
<span class="lineNum">      31 </span>            : #include &lt;boost/type_traits/alignment_of.hpp&gt;
<span class="lineNum">      32 </span>            : #include &lt;boost/type_traits/has_nothrow_constructor.hpp&gt;
<span class="lineNum">      33 </span>            : #include &lt;boost/type_traits/type_with_alignment.hpp&gt;
<span class="lineNum">      34 </span>            : #include &lt;boost/type_traits/remove_const.hpp&gt;
<span class="lineNum">      35 </span>            : #include &lt;boost/type_traits/remove_reference.hpp&gt;
<span class="lineNum">      36 </span>            : #include &lt;boost/type_traits/decay.hpp&gt;
<span class="lineNum">      37 </span>            : #include &lt;boost/type_traits/is_base_of.hpp&gt;
<span class="lineNum">      38 </span>            : #include &lt;boost/type_traits/is_lvalue_reference.hpp&gt;
<span class="lineNum">      39 </span>            : #include &lt;boost/type_traits/is_nothrow_move_assignable.hpp&gt;
<span class="lineNum">      40 </span>            : #include &lt;boost/type_traits/is_nothrow_move_constructible.hpp&gt;
<span class="lineNum">      41 </span>            : #include &lt;boost/type_traits/is_reference.hpp&gt;
<span class="lineNum">      42 </span>            : #include &lt;boost/type_traits/is_rvalue_reference.hpp&gt;
<span class="lineNum">      43 </span>            : #include &lt;boost/type_traits/is_same.hpp&gt;
<span class="lineNum">      44 </span>            : #include &lt;boost/mpl/if.hpp&gt;
<span class="lineNum">      45 </span>            : #include &lt;boost/mpl/bool.hpp&gt;
<span class="lineNum">      46 </span>            : #include &lt;boost/mpl/not.hpp&gt;
<span class="lineNum">      47 </span>            : #include &lt;boost/detail/reference_content.hpp&gt;
<span class="lineNum">      48 </span>            : #include &lt;boost/move/utility.hpp&gt;
<span class="lineNum">      49 </span>            : #include &lt;boost/none.hpp&gt;
<span class="lineNum">      50 </span>            : #include &lt;boost/utility/addressof.hpp&gt;
<span class="lineNum">      51 </span>            : #include &lt;boost/utility/compare_pointees.hpp&gt;
<span class="lineNum">      52 </span>            : #include &lt;boost/utility/enable_if.hpp&gt;
<span class="lineNum">      53 </span>            : #include &lt;boost/utility/in_place_factory.hpp&gt;
<span class="lineNum">      54 </span>            : #include &lt;boost/utility/swap.hpp&gt;
<span class="lineNum">      55 </span>            : 
<span class="lineNum">      56 </span>            : 
<span class="lineNum">      57 </span>            : 
<span class="lineNum">      58 </span>            : #include &lt;boost/optional/optional_fwd.hpp&gt;
<span class="lineNum">      59 </span>            : 
<span class="lineNum">      60 </span>            : #if (defined BOOST_NO_CXX11_RVALUE_REFERENCES) || (defined BOOST_OPTIONAL_CONFIG_NO_RVALUE_REFERENCES)
<span class="lineNum">      61 </span>            : #define BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
<span class="lineNum">      62 </span>            : #endif
<span class="lineNum">      63 </span>            : 
<span class="lineNum">      64 </span>            : #if BOOST_WORKAROUND(BOOST_INTEL_CXX_VERSION,&lt;=700)
<span class="lineNum">      65 </span>            : // AFAICT only Intel 7 correctly resolves the overload set
<span class="lineNum">      66 </span>            : // that includes the in-place factory taking functions,
<span class="lineNum">      67 </span>            : // so for the other icc versions, in-place factory support
<span class="lineNum">      68 </span>            : // is disabled
<span class="lineNum">      69 </span>            : #define BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT
<span class="lineNum">      70 </span>            : #endif
<span class="lineNum">      71 </span>            : 
<span class="lineNum">      72 </span>            : #if BOOST_WORKAROUND(__BORLANDC__, &lt;= 0x551)
<span class="lineNum">      73 </span>            : // BCB (5.5.1) cannot parse the nested template struct in an inplace factory.
<span class="lineNum">      74 </span>            : #define BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT
<span class="lineNum">      75 </span>            : #endif
<span class="lineNum">      76 </span>            : 
<span class="lineNum">      77 </span>            : #if !defined(BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT) \
<span class="lineNum">      78 </span>            :     &amp;&amp; BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x581) )
<span class="lineNum">      79 </span>            : // BCB (up to 5.64) has the following bug:
<span class="lineNum">      80 </span>            : //   If there is a member function/operator template of the form
<span class="lineNum">      81 </span>            : //     template&lt;class Expr&gt; mfunc( Expr expr ) ;
<span class="lineNum">      82 </span>            : //   some calls are resolved to this even if there are other better matches.
<span class="lineNum">      83 </span>            : //   The effect of this bug is that calls to converting ctors and assignments
<span class="lineNum">      84 </span>            : //   are incrorrectly sink to this general catch-all member function template as shown above.
<span class="lineNum">      85 </span>            : #define BOOST_OPTIONAL_WEAK_OVERLOAD_RESOLUTION
<span class="lineNum">      86 </span>            : #endif
<span class="lineNum">      87 </span>            : 
<span class="lineNum">      88 </span>            : #if defined(__GNUC__) &amp;&amp; !defined(__INTEL_COMPILER)
<span class="lineNum">      89 </span>            : // GCC since 3.3 has may_alias attribute that helps to alleviate optimizer issues with
<span class="lineNum">      90 </span>            : // regard to violation of the strict aliasing rules. The optional&lt; T &gt; storage type is marked
<span class="lineNum">      91 </span>            : // with this attribute in order to let the compiler know that it will alias objects of type T
<span class="lineNum">      92 </span>            : // and silence compilation warnings.
<span class="lineNum">      93 </span>            : #define BOOST_OPTIONAL_DETAIL_USE_ATTRIBUTE_MAY_ALIAS
<span class="lineNum">      94 </span>            : #endif
<span class="lineNum">      95 </span>            : 
<span class="lineNum">      96 </span>            : // Daniel Wallin discovered that bind/apply.hpp badly interacts with the apply&lt;&gt;
<span class="lineNum">      97 </span>            : // member template of a factory as used in the optional&lt;&gt; implementation.
<span class="lineNum">      98 </span>            : // He proposed this simple fix which is to move the call to apply&lt;&gt; outside
<span class="lineNum">      99 </span>            : // namespace boost.
<span class="lineNum">     100 </span>            : namespace boost_optional_detail
<span class="lineNum">     101 </span>            : {
<span class="lineNum">     102 </span>            :   template &lt;class T, class Factory&gt;
<span class="lineNum">     103 </span>            :   inline void construct(Factory const&amp; factory, void* address)
<span class="lineNum">     104 </span>            :   {
<span class="lineNum">     105 </span>            :     factory.BOOST_NESTED_TEMPLATE apply&lt;T&gt;(address);
<span class="lineNum">     106 </span>            :   }
<span class="lineNum">     107 </span>            : }
<span class="lineNum">     108 </span>            : 
<span class="lineNum">     109 </span>            : 
<span class="lineNum">     110 </span>            : namespace boost {
<span class="lineNum">     111 </span>            : 
<span class="lineNum">     112 </span>            : class in_place_factory_base ;
<span class="lineNum">     113 </span>            : class typed_in_place_factory_base ;
<span class="lineNum">     114 </span>            : 
<span class="lineNum">     115 </span>            : // This forward is needed to refer to namespace scope swap from the member swap
<span class="lineNum">     116 </span>            : template&lt;class T&gt; void swap ( optional&lt;T&gt;&amp; x, optional&lt;T&gt;&amp; y );
<span class="lineNum">     117 </span>            : 
<span class="lineNum">     118 </span>            : namespace optional_detail {
<span class="lineNum">     119 </span>            : // This local class is used instead of that in &quot;aligned_storage.hpp&quot;
<span class="lineNum">     120 </span>            : // because I've found the 'official' class to ICE BCB5.5
<span class="lineNum">     121 </span>            : // when some types are used with optional&lt;&gt;
<span class="lineNum">     122 </span>            : // (due to sizeof() passed down as a non-type template parameter)
<span class="lineNum">     123 </span>            : template &lt;class T&gt;
<span class="lineNum">     124 </span>            : class aligned_storage
<span class="lineNum">     125 </span>            : {
<span class="lineNum">     126 </span>            :     // Borland ICEs if unnamed unions are used for this!
<span class="lineNum">     127 </span>            :     union
<span class="lineNum">     128 </span>            :     // This works around GCC warnings about breaking strict aliasing rules when casting storage address to T*
<span class="lineNum">     129 </span>            : #if defined(BOOST_OPTIONAL_DETAIL_USE_ATTRIBUTE_MAY_ALIAS)
<span class="lineNum">     130 </span>            :     __attribute__((__may_alias__))
<span class="lineNum">     131 </span>            : #endif
<span class="lineNum">     132 </span>            :     dummy_u
<span class="lineNum">     133 </span>            :     {
<span class="lineNum">     134 </span>            :         char data[ sizeof(T) ];
<span class="lineNum">     135 </span>            :         BOOST_DEDUCED_TYPENAME type_with_alignment&lt;
<span class="lineNum">     136 </span>            :           ::boost::alignment_of&lt;T&gt;::value &gt;::type aligner_;
<span class="lineNum">     137 </span>            :     } dummy_ ;
<span class="lineNum">     138 </span>            : 
<span class="lineNum">     139 </span>            :   public:
<span class="lineNum">     140 </span>            : 
<span class="lineNum">     141 </span>            : #if defined(BOOST_OPTIONAL_DETAIL_USE_ATTRIBUTE_MAY_ALIAS)
<span class="lineNum">     142 </span><span class="lineNoCov">          0 :     void const* address() const { return &amp;dummy_; }</span>
<span class="lineNum">     143 </span><span class="lineNoCov">          0 :     void      * address()       { return &amp;dummy_; }</span>
<span class="lineNum">     144 </span>            : #else
<span class="lineNum">     145 </span>            :     void const* address() const { return dummy_.data; }
<span class="lineNum">     146 </span>            :     void      * address()       { return dummy_.data; }
<span class="lineNum">     147 </span>            : #endif
<span class="lineNum">     148 </span>            : } ;
<span class="lineNum">     149 </span>            : 
<span class="lineNum">     150 </span>            : template&lt;class T&gt;
<span class="lineNum">     151 </span>            : struct types_when_isnt_ref
<span class="lineNum">     152 </span>            : {
<span class="lineNum">     153 </span>            :   typedef T const&amp; reference_const_type ;
<span class="lineNum">     154 </span>            :   typedef T &amp;      reference_type ;
<span class="lineNum">     155 </span>            : #ifndef  BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
<span class="lineNum">     156 </span>            :   typedef T &amp;&amp;     rval_reference_type ;
<span class="lineNum">     157 </span>            :   typedef T &amp;&amp;     reference_type_of_temporary_wrapper;
<span class="lineNum">     158 </span>            : #ifdef BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES
<span class="lineNum">     159 </span>            :   // GCC 4.4 has support for an early draft of rvalue references. The conforming version below
<span class="lineNum">     160 </span>            :   // causes warnings about returning references to a temporary.
<span class="lineNum">     161 </span>            :   static T&amp;&amp; move(T&amp;&amp; r) { return r; }
<span class="lineNum">     162 </span>            : #else
<span class="lineNum">     163 </span>            :   static rval_reference_type move(reference_type r) { return boost::move(r); }
<span class="lineNum">     164 </span>            : #endif
<span class="lineNum">     165 </span>            : #endif
<span class="lineNum">     166 </span>            :   typedef T const* pointer_const_type ;
<span class="lineNum">     167 </span>            :   typedef T *      pointer_type ;
<span class="lineNum">     168 </span>            :   typedef T const&amp; argument_type ;
<span class="lineNum">     169 </span>            : } ;
<span class="lineNum">     170 </span>            : 
<span class="lineNum">     171 </span>            : template&lt;class T&gt;
<span class="lineNum">     172 </span>            : struct types_when_is_ref
<span class="lineNum">     173 </span>            : {
<span class="lineNum">     174 </span>            :   typedef BOOST_DEDUCED_TYPENAME remove_reference&lt;T&gt;::type raw_type ;
<span class="lineNum">     175 </span>            : 
<span class="lineNum">     176 </span>            :   typedef raw_type&amp;  reference_const_type ;
<span class="lineNum">     177 </span>            :   typedef raw_type&amp;  reference_type ;
<span class="lineNum">     178 </span>            : #ifndef  BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
<span class="lineNum">     179 </span>            :   typedef BOOST_DEDUCED_TYPENAME remove_const&lt;raw_type&gt;::type&amp;&amp; rval_reference_type ;
<span class="lineNum">     180 </span>            :   typedef raw_type&amp;  reference_type_of_temporary_wrapper;
<span class="lineNum">     181 </span>            :   static reference_type move(reference_type r) { return r; }
<span class="lineNum">     182 </span>            : #endif
<span class="lineNum">     183 </span>            :   typedef raw_type*  pointer_const_type ;
<span class="lineNum">     184 </span>            :   typedef raw_type*  pointer_type ;
<span class="lineNum">     185 </span>            :   typedef raw_type&amp;  argument_type ;
<span class="lineNum">     186 </span>            : } ;
<span class="lineNum">     187 </span>            : 
<span class="lineNum">     188 </span>            : template &lt;class To, class From&gt;
<span class="lineNum">     189 </span>            : void prevent_binding_rvalue_ref_to_optional_lvalue_ref()
<span class="lineNum">     190 </span>            : {
<span class="lineNum">     191 </span>            : #ifndef BOOST_OPTIONAL_CONFIG_ALLOW_BINDING_TO_RVALUES
<span class="lineNum">     192 </span>            :   BOOST_STATIC_ASSERT_MSG(
<span class="lineNum">     193 </span>            :     !boost::is_lvalue_reference&lt;To&gt;::value || !boost::is_rvalue_reference&lt;From&gt;::value, 
<span class="lineNum">     194 </span>            :     &quot;binding rvalue references to optional lvalue references is disallowed&quot;);
<span class="lineNum">     195 </span>            : #endif    
<span class="lineNum">     196 </span>            : }
<span class="lineNum">     197 </span>            : 
<span class="lineNum">     198 </span>            : struct optional_tag {} ;
<span class="lineNum">     199 </span>            : 
<span class="lineNum">     200 </span>            : template&lt;class T&gt;
<span class="lineNum">     201 </span>            : class optional_base : public optional_tag
<span class="lineNum">     202 </span>            : {
<span class="lineNum">     203 </span>            :   private :
<span class="lineNum">     204 </span>            : 
<span class="lineNum">     205 </span>            :     typedef
<span class="lineNum">     206 </span>            : #if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
<span class="lineNum">     207 </span>            :     BOOST_DEDUCED_TYPENAME
<span class="lineNum">     208 </span>            : #endif
<span class="lineNum">     209 </span>            :     ::boost::detail::make_reference_content&lt;T&gt;::type internal_type ;
<span class="lineNum">     210 </span>            : 
<span class="lineNum">     211 </span>            :     typedef aligned_storage&lt;internal_type&gt; storage_type ;
<span class="lineNum">     212 </span>            : 
<span class="lineNum">     213 </span>            :     typedef types_when_isnt_ref&lt;T&gt; types_when_not_ref ;
<span class="lineNum">     214 </span>            :     typedef types_when_is_ref&lt;T&gt;   types_when_ref   ;
<span class="lineNum">     215 </span>            : 
<span class="lineNum">     216 </span>            :     typedef optional_base&lt;T&gt; this_type ;
<span class="lineNum">     217 </span>            : 
<span class="lineNum">     218 </span>            :   protected :
<span class="lineNum">     219 </span>            : 
<span class="lineNum">     220 </span>            :     typedef T value_type ;
<span class="lineNum">     221 </span>            : 
<span class="lineNum">     222 </span>            :     typedef mpl::true_  is_reference_tag ;
<span class="lineNum">     223 </span>            :     typedef mpl::false_ is_not_reference_tag ;
<span class="lineNum">     224 </span>            : 
<span class="lineNum">     225 </span>            :     typedef BOOST_DEDUCED_TYPENAME is_reference&lt;T&gt;::type is_reference_predicate ;
<span class="lineNum">     226 </span>            : 
<span class="lineNum">     227 </span>            :   public:
<span class="lineNum">     228 </span>            :     typedef BOOST_DEDUCED_TYPENAME mpl::if_&lt;is_reference_predicate,types_when_ref,types_when_not_ref&gt;::type types ;
<span class="lineNum">     229 </span>            : 
<span class="lineNum">     230 </span>            :   protected:
<span class="lineNum">     231 </span>            :     typedef BOOST_DEDUCED_TYPENAME types::reference_type       reference_type ;
<span class="lineNum">     232 </span>            :     typedef BOOST_DEDUCED_TYPENAME types::reference_const_type reference_const_type ;
<span class="lineNum">     233 </span>            : #ifndef  BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
<span class="lineNum">     234 </span>            :     typedef BOOST_DEDUCED_TYPENAME types::rval_reference_type  rval_reference_type ;
<span class="lineNum">     235 </span>            :     typedef BOOST_DEDUCED_TYPENAME types::reference_type_of_temporary_wrapper reference_type_of_temporary_wrapper ;
<span class="lineNum">     236 </span>            : #endif
<span class="lineNum">     237 </span>            :     typedef BOOST_DEDUCED_TYPENAME types::pointer_type         pointer_type ;
<span class="lineNum">     238 </span>            :     typedef BOOST_DEDUCED_TYPENAME types::pointer_const_type   pointer_const_type ;
<span class="lineNum">     239 </span>            :     typedef BOOST_DEDUCED_TYPENAME types::argument_type        argument_type ;
<span class="lineNum">     240 </span>            : 
<span class="lineNum">     241 </span>            :     // Creates an optional&lt;T&gt; uninitialized.
<span class="lineNum">     242 </span>            :     // No-throw
<span class="lineNum">     243 </span>            :     optional_base()
<span class="lineNum">     244 </span>            :       :
<span class="lineNum">     245 </span><span class="lineNoCov">          0 :       m_initialized(false) {}</span>
<span class="lineNum">     246 </span>            : 
<span class="lineNum">     247 </span>            :     // Creates an optional&lt;T&gt; uninitialized.
<span class="lineNum">     248 </span>            :     // No-throw
<span class="lineNum">     249 </span>            :     optional_base ( none_t )
<span class="lineNum">     250 </span>            :       :
<span class="lineNum">     251 </span>            :       m_initialized(false) {}
<span class="lineNum">     252 </span>            : 
<span class="lineNum">     253 </span>            :     // Creates an optional&lt;T&gt; initialized with 'val'.
<span class="lineNum">     254 </span>            :     // Can throw if T::T(T const&amp;) does
<span class="lineNum">     255 </span>            :     optional_base ( argument_type val )
<span class="lineNum">     256 </span>            :       :
<span class="lineNum">     257 </span>            :       m_initialized(false)
<span class="lineNum">     258 </span>            :     {
<span class="lineNum">     259 </span>            :       construct(val);
<span class="lineNum">     260 </span>            :     }
<span class="lineNum">     261 </span>            : 
<span class="lineNum">     262 </span>            : #ifndef  BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
<span class="lineNum">     263 </span>            :     // move-construct an optional&lt;T&gt; initialized from an rvalue-ref to 'val'.
<span class="lineNum">     264 </span>            :     // Can throw if T::T(T&amp;&amp;) does
<span class="lineNum">     265 </span>            :     optional_base ( rval_reference_type val )
<span class="lineNum">     266 </span>            :       :
<span class="lineNum">     267 </span>            :       m_initialized(false)
<span class="lineNum">     268 </span>            :     {
<span class="lineNum">     269 </span>            :       construct( boost::move(val) );
<span class="lineNum">     270 </span>            :     }
<span class="lineNum">     271 </span>            : #endif
<span class="lineNum">     272 </span>            : 
<span class="lineNum">     273 </span>            :     // Creates an optional&lt;T&gt; initialized with 'val' IFF cond is true, otherwise creates an uninitialzed optional&lt;T&gt;.
<span class="lineNum">     274 </span>            :     // Can throw if T::T(T const&amp;) does
<span class="lineNum">     275 </span>            :     optional_base ( bool cond, argument_type val )
<span class="lineNum">     276 </span>            :       :
<span class="lineNum">     277 </span>            :       m_initialized(false)
<span class="lineNum">     278 </span>            :     {
<span class="lineNum">     279 </span>            :       if ( cond )
<span class="lineNum">     280 </span>            :         construct(val);
<span class="lineNum">     281 </span>            :     }
<span class="lineNum">     282 </span>            : 
<span class="lineNum">     283 </span>            :     // Creates a deep copy of another optional&lt;T&gt;
<span class="lineNum">     284 </span>            :     // Can throw if T::T(T const&amp;) does
<span class="lineNum">     285 </span>            :     optional_base ( optional_base const&amp; rhs )
<span class="lineNum">     286 </span>            :       :
<span class="lineNum">     287 </span><span class="lineNoCov">          0 :       m_initialized(false)</span>
<span class="lineNum">     288 </span>            :     {
<span class="lineNum">     289 </span><span class="lineNoCov">          0 :       if ( rhs.is_initialized() )</span>
<span class="lineNum">     290 </span>            :         construct(rhs.get_impl());
<span class="lineNum">     291 </span>            :     }
<span class="lineNum">     292 </span>            : 
<span class="lineNum">     293 </span>            : #ifndef  BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
<span class="lineNum">     294 </span>            :     // Creates a deep move of another optional&lt;T&gt;
<span class="lineNum">     295 </span>            :     // Can throw if T::T(T&amp;&amp;) does
<span class="lineNum">     296 </span>            :     optional_base ( optional_base&amp;&amp; rhs )
<span class="lineNum">     297 </span>            :       :
<span class="lineNum">     298 </span>            :       m_initialized(false)
<span class="lineNum">     299 </span>            :     {
<span class="lineNum">     300 </span>            :       if ( rhs.is_initialized() )
<span class="lineNum">     301 </span>            :         construct( boost::move(rhs.get_impl()) );
<span class="lineNum">     302 </span>            :     }
<span class="lineNum">     303 </span>            : #endif
<span class="lineNum">     304 </span>            : 
<span class="lineNum">     305 </span>            : #ifndef  BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
<span class="lineNum">     306 </span>            : 
<span class="lineNum">     307 </span>            :     template&lt;class Expr, class PtrExpr&gt;
<span class="lineNum">     308 </span>            :     explicit optional_base ( Expr&amp;&amp; expr, PtrExpr const* tag )
<span class="lineNum">     309 </span>            :       :
<span class="lineNum">     310 </span>            :       m_initialized(false)
<span class="lineNum">     311 </span>            :     {
<span class="lineNum">     312 </span>            :       construct(boost::forward&lt;Expr&gt;(expr),tag);
<span class="lineNum">     313 </span>            :     }
<span class="lineNum">     314 </span>            : 
<span class="lineNum">     315 </span>            : #else
<span class="lineNum">     316 </span>            :     // This is used for both converting and in-place constructions.
<span class="lineNum">     317 </span>            :     // Derived classes use the 'tag' to select the appropriate
<span class="lineNum">     318 </span>            :     // implementation (the correct 'construct()' overload)
<span class="lineNum">     319 </span>            :     template&lt;class Expr&gt;
<span class="lineNum">     320 </span>            :     explicit optional_base ( Expr const&amp; expr, Expr const* tag )
<span class="lineNum">     321 </span>            :       :
<span class="lineNum">     322 </span>            :       m_initialized(false)
<span class="lineNum">     323 </span>            :     {
<span class="lineNum">     324 </span>            :       construct(expr,tag);
<span class="lineNum">     325 </span>            :     }
<span class="lineNum">     326 </span>            : 
<span class="lineNum">     327 </span>            : #endif
<span class="lineNum">     328 </span>            : 
<span class="lineNum">     329 </span>            : 
<span class="lineNum">     330 </span>            :     // No-throw (assuming T::~T() doesn't)
<span class="lineNum">     331 </span><span class="lineNoCov">          0 :     ~optional_base() { destroy() ; }</span>
<a name="332"><span class="lineNum">     332 </span>            : </a>
<span class="lineNum">     333 </span>            :     // Assigns from another optional&lt;T&gt; (deep-copies the rhs value)
<span class="lineNum">     334 </span><span class="lineNoCov">          0 :     void assign ( optional_base const&amp; rhs )</span>
<span class="lineNum">     335 </span>            :     {
<span class="lineNum">     336 </span><span class="lineNoCov">          0 :       if (is_initialized())</span>
<span class="lineNum">     337 </span>            :       {
<span class="lineNum">     338 </span><span class="lineNoCov">          0 :         if ( rhs.is_initialized() )</span>
<span class="lineNum">     339 </span>            :              assign_value(rhs.get_impl(), is_reference_predicate() );
<span class="lineNum">     340 </span>            :         else destroy();
<span class="lineNum">     341 </span>            :       }
<span class="lineNum">     342 </span>            :       else
<span class="lineNum">     343 </span>            :       {
<span class="lineNum">     344 </span><span class="lineNoCov">          0 :         if ( rhs.is_initialized() )</span>
<span class="lineNum">     345 </span>            :           construct(rhs.get_impl());
<span class="lineNum">     346 </span>            :       }
<span class="lineNum">     347 </span><span class="lineNoCov">          0 :     }</span>
<span class="lineNum">     348 </span>            :     
<span class="lineNum">     349 </span>            : #ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
<span class="lineNum">     350 </span>            :     // Assigns from another optional&lt;T&gt; (deep-moves the rhs value)
<span class="lineNum">     351 </span>            :     void assign ( optional_base&amp;&amp; rhs )
<span class="lineNum">     352 </span>            :     {
<span class="lineNum">     353 </span>            :       if (is_initialized())
<span class="lineNum">     354 </span>            :       {
<span class="lineNum">     355 </span>            :         if ( rhs.is_initialized() )
<span class="lineNum">     356 </span>            :              assign_value(boost::move(rhs.get_impl()), is_reference_predicate() );
<span class="lineNum">     357 </span>            :         else destroy();
<span class="lineNum">     358 </span>            :       }
<span class="lineNum">     359 </span>            :       else
<span class="lineNum">     360 </span>            :       {
<span class="lineNum">     361 </span>            :         if ( rhs.is_initialized() )
<span class="lineNum">     362 </span>            :           construct(boost::move(rhs.get_impl()));
<span class="lineNum">     363 </span>            :       }
<span class="lineNum">     364 </span>            :     }
<span class="lineNum">     365 </span>            : #endif 
<span class="lineNum">     366 </span>            : 
<span class="lineNum">     367 </span>            :     // Assigns from another _convertible_ optional&lt;U&gt; (deep-copies the rhs value)
<span class="lineNum">     368 </span>            :     template&lt;class U&gt;
<span class="lineNum">     369 </span>            :     void assign ( optional&lt;U&gt; const&amp; rhs )
<span class="lineNum">     370 </span>            :     {
<span class="lineNum">     371 </span>            :       if (is_initialized())
<span class="lineNum">     372 </span>            :       {
<span class="lineNum">     373 </span>            :         if ( rhs.is_initialized() )
<span class="lineNum">     374 </span>            : #ifndef BOOST_OPTIONAL_CONFIG_RESTORE_ASSIGNMENT_OF_NONCONVERTIBLE_TYPES
<span class="lineNum">     375 </span>            :           assign_value(rhs.get(), is_reference_predicate() );
<span class="lineNum">     376 </span>            : #else
<span class="lineNum">     377 </span>            :           assign_value(static_cast&lt;value_type&gt;(rhs.get()), is_reference_predicate() );
<span class="lineNum">     378 </span>            : #endif
<span class="lineNum">     379 </span>            :           
<span class="lineNum">     380 </span>            :         else destroy();
<span class="lineNum">     381 </span>            :       }
<span class="lineNum">     382 </span>            :       else
<span class="lineNum">     383 </span>            :       {
<span class="lineNum">     384 </span>            :         if ( rhs.is_initialized() )
<span class="lineNum">     385 </span>            : #ifndef BOOST_OPTIONAL_CONFIG_RESTORE_ASSIGNMENT_OF_NONCONVERTIBLE_TYPES
<span class="lineNum">     386 </span>            :           construct(rhs.get());
<span class="lineNum">     387 </span>            : #else
<span class="lineNum">     388 </span>            :           construct(static_cast&lt;value_type&gt;(rhs.get()));
<span class="lineNum">     389 </span>            : #endif
<span class="lineNum">     390 </span>            :       }
<span class="lineNum">     391 </span>            :     }
<span class="lineNum">     392 </span>            : 
<span class="lineNum">     393 </span>            : #ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
<span class="lineNum">     394 </span>            :     // move-assigns from another _convertible_ optional&lt;U&gt; (deep-moves from the rhs value)
<span class="lineNum">     395 </span>            :     template&lt;class U&gt;
<span class="lineNum">     396 </span>            :     void assign ( optional&lt;U&gt;&amp;&amp; rhs )
<span class="lineNum">     397 </span>            :     {
<span class="lineNum">     398 </span>            :       typedef BOOST_DEDUCED_TYPENAME optional&lt;U&gt;::rval_reference_type ref_type;
<span class="lineNum">     399 </span>            :       if (is_initialized())
<span class="lineNum">     400 </span>            :       {
<span class="lineNum">     401 </span>            :         if ( rhs.is_initialized() )
<span class="lineNum">     402 </span>            :              assign_value(static_cast&lt;ref_type&gt;(rhs.get()), is_reference_predicate() );
<span class="lineNum">     403 </span>            :         else destroy();
<span class="lineNum">     404 </span>            :       }
<span class="lineNum">     405 </span>            :       else
<span class="lineNum">     406 </span>            :       {
<span class="lineNum">     407 </span>            :         if ( rhs.is_initialized() )
<span class="lineNum">     408 </span>            :           construct(static_cast&lt;ref_type&gt;(rhs.get()));
<span class="lineNum">     409 </span>            :       }
<span class="lineNum">     410 </span>            :     }
<span class="lineNum">     411 </span>            : #endif
<span class="lineNum">     412 </span>            :     
<span class="lineNum">     413 </span>            :     // Assigns from a T (deep-copies the rhs value)
<span class="lineNum">     414 </span>            :     void assign ( argument_type val )
<span class="lineNum">     415 </span>            :     {
<span class="lineNum">     416 </span>            :       if (is_initialized())
<span class="lineNum">     417 </span>            :            assign_value(val, is_reference_predicate() );
<span class="lineNum">     418 </span>            :       else construct(val);
<span class="lineNum">     419 </span>            :     }
<span class="lineNum">     420 </span>            :     
<span class="lineNum">     421 </span>            : #ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
<span class="lineNum">     422 </span>            :     // Assigns from a T (deep-moves the rhs value)
<span class="lineNum">     423 </span>            :     void assign ( rval_reference_type val )
<span class="lineNum">     424 </span>            :     {
<span class="lineNum">     425 </span>            :       if (is_initialized())
<span class="lineNum">     426 </span>            :            assign_value( boost::move(val), is_reference_predicate() );
<span class="lineNum">     427 </span>            :       else construct( boost::move(val) );
<span class="lineNum">     428 </span>            :     }
<span class="lineNum">     429 </span>            : #endif
<span class="lineNum">     430 </span>            : 
<span class="lineNum">     431 </span>            :     // Assigns from &quot;none&quot;, destroying the current value, if any, leaving this UNINITIALIZED
<span class="lineNum">     432 </span>            :     // No-throw (assuming T::~T() doesn't)
<span class="lineNum">     433 </span>            :     void assign ( none_t ) BOOST_NOEXCEPT { destroy(); }
<span class="lineNum">     434 </span>            : 
<span class="lineNum">     435 </span>            : #ifndef BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT
<span class="lineNum">     436 </span>            : 
<span class="lineNum">     437 </span>            : #ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
<span class="lineNum">     438 </span>            :     template&lt;class Expr, class ExprPtr&gt;
<span class="lineNum">     439 </span>            :     void assign_expr ( Expr&amp;&amp; expr, ExprPtr const* tag )
<span class="lineNum">     440 </span>            :     {
<span class="lineNum">     441 </span>            :       if (is_initialized())
<span class="lineNum">     442 </span>            :         assign_expr_to_initialized(boost::forward&lt;Expr&gt;(expr),tag);
<span class="lineNum">     443 </span>            :       else construct(boost::forward&lt;Expr&gt;(expr),tag);
<span class="lineNum">     444 </span>            :     }
<span class="lineNum">     445 </span>            : #else
<span class="lineNum">     446 </span>            :     template&lt;class Expr&gt;
<span class="lineNum">     447 </span>            :     void assign_expr ( Expr const&amp; expr, Expr const* tag )
<span class="lineNum">     448 </span>            :     {
<span class="lineNum">     449 </span>            :       if (is_initialized())
<span class="lineNum">     450 </span>            :         assign_expr_to_initialized(expr,tag);
<span class="lineNum">     451 </span>            :       else construct(expr,tag);
<span class="lineNum">     452 </span>            :     }
<span class="lineNum">     453 </span>            : #endif
<span class="lineNum">     454 </span>            : 
<span class="lineNum">     455 </span>            : #endif
<span class="lineNum">     456 </span>            : 
<span class="lineNum">     457 </span>            :   public :
<span class="lineNum">     458 </span>            : 
<span class="lineNum">     459 </span>            :     // **DEPPRECATED** Destroys the current value, if any, leaving this UNINITIALIZED
<span class="lineNum">     460 </span>            :     // No-throw (assuming T::~T() doesn't)
<span class="lineNum">     461 </span>            :     void reset() BOOST_NOEXCEPT { destroy(); }
<span class="lineNum">     462 </span>            : 
<span class="lineNum">     463 </span>            :     // **DEPPRECATED** Replaces the current value -if any- with 'val'
<span class="lineNum">     464 </span>            :     void reset ( argument_type val ) { assign(val); }
<span class="lineNum">     465 </span>            : 
<span class="lineNum">     466 </span>            :     // Returns a pointer to the value if this is initialized, otherwise,
<span class="lineNum">     467 </span>            :     // returns NULL.
<span class="lineNum">     468 </span>            :     // No-throw
<span class="lineNum">     469 </span>            :     pointer_const_type get_ptr() const { return m_initialized ? get_ptr_impl() : 0 ; }
<span class="lineNum">     470 </span><span class="lineNoCov">          0 :     pointer_type       get_ptr()       { return m_initialized ? get_ptr_impl() : 0 ; }</span>
<span class="lineNum">     471 </span>            : 
<span class="lineNum">     472 </span>            :     bool is_initialized() const { return m_initialized ; }
<span class="lineNum">     473 </span>            : 
<span class="lineNum">     474 </span>            :   protected :
<span class="lineNum">     475 </span>            : 
<span class="lineNum">     476 </span>            :     void construct ( argument_type val )
<span class="lineNum">     477 </span>            :      {
<span class="lineNum">     478 </span><span class="lineNoCov">          0 :        ::new (m_storage.address()) internal_type(val) ;</span>
<span class="lineNum">     479 </span><span class="lineNoCov">          0 :        m_initialized = true ;</span>
<span class="lineNum">     480 </span>            :      }
<span class="lineNum">     481 </span>            :      
<span class="lineNum">     482 </span>            : #ifndef  BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
<span class="lineNum">     483 </span>            :     void construct ( rval_reference_type val )
<span class="lineNum">     484 </span>            :      {
<span class="lineNum">     485 </span>            :        ::new (m_storage.address()) internal_type( types::move(val) ) ;
<span class="lineNum">     486 </span>            :        m_initialized = true ;
<span class="lineNum">     487 </span>            :      }
<span class="lineNum">     488 </span>            : #endif
<span class="lineNum">     489 </span>            : 
<span class="lineNum">     490 </span>            : 
<span class="lineNum">     491 </span>            : #if (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES) &amp;&amp; (!defined BOOST_NO_CXX11_VARIADIC_TEMPLATES)
<span class="lineNum">     492 </span>            :     // Constructs in-place
<span class="lineNum">     493 </span>            :     // upon exception *this is always uninitialized
<span class="lineNum">     494 </span>            :     template&lt;class... Args&gt;
<span class="lineNum">     495 </span>            :     void emplace_assign ( Args&amp;&amp;... args )
<span class="lineNum">     496 </span>            :      {
<span class="lineNum">     497 </span>            :        destroy();
<span class="lineNum">     498 </span>            :        ::new (m_storage.address()) internal_type( boost::forward&lt;Args&gt;(args)... );
<span class="lineNum">     499 </span>            :        m_initialized = true ;
<span class="lineNum">     500 </span>            :      }
<span class="lineNum">     501 </span>            : #elif (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES)
<span class="lineNum">     502 </span>            :     template&lt;class Arg&gt;
<span class="lineNum">     503 </span>            :     void emplace_assign ( Arg&amp;&amp; arg )
<span class="lineNum">     504 </span>            :      {
<span class="lineNum">     505 </span>            :        destroy();
<span class="lineNum">     506 </span>            :        ::new (m_storage.address()) internal_type( boost::forward&lt;Arg&gt;(arg) );
<span class="lineNum">     507 </span>            :        m_initialized = true ;
<span class="lineNum">     508 </span>            :      }
<span class="lineNum">     509 </span>            : #else
<span class="lineNum">     510 </span>            :     template&lt;class Arg&gt;
<span class="lineNum">     511 </span>            :     void emplace_assign ( const Arg&amp; arg )
<span class="lineNum">     512 </span>            :      {
<span class="lineNum">     513 </span>            :        destroy();
<span class="lineNum">     514 </span>            :        ::new (m_storage.address()) internal_type( arg );
<span class="lineNum">     515 </span>            :        m_initialized = true ;
<span class="lineNum">     516 </span>            :      }
<span class="lineNum">     517 </span>            :      
<span class="lineNum">     518 </span>            :      template&lt;class Arg&gt;
<span class="lineNum">     519 </span>            :     void emplace_assign ( Arg&amp; arg )
<span class="lineNum">     520 </span>            :      {
<span class="lineNum">     521 </span>            :        destroy();
<span class="lineNum">     522 </span>            :        ::new (m_storage.address()) internal_type( arg );
<span class="lineNum">     523 </span>            :        m_initialized = true ;
<span class="lineNum">     524 </span>            :      }
<span class="lineNum">     525 </span>            : #endif
<span class="lineNum">     526 </span>            : 
<span class="lineNum">     527 </span>            : #ifndef BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT
<span class="lineNum">     528 </span>            : 
<span class="lineNum">     529 </span>            : #ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
<span class="lineNum">     530 </span>            :     // Constructs in-place using the given factory
<span class="lineNum">     531 </span>            :     template&lt;class Expr&gt;
<span class="lineNum">     532 </span>            :     void construct ( Expr&amp;&amp; factory, in_place_factory_base const* )
<span class="lineNum">     533 </span>            :      {
<span class="lineNum">     534 </span>            :        BOOST_STATIC_ASSERT ( ::boost::mpl::not_&lt;is_reference_predicate&gt;::value ) ;
<span class="lineNum">     535 </span>            :        boost_optional_detail::construct&lt;value_type&gt;(factory, m_storage.address());
<span class="lineNum">     536 </span>            :        m_initialized = true ;
<span class="lineNum">     537 </span>            :      }
<span class="lineNum">     538 </span>            : 
<span class="lineNum">     539 </span>            :     // Constructs in-place using the given typed factory
<span class="lineNum">     540 </span>            :     template&lt;class Expr&gt;
<span class="lineNum">     541 </span>            :     void construct ( Expr&amp;&amp; factory, typed_in_place_factory_base const* )
<span class="lineNum">     542 </span>            :      {
<span class="lineNum">     543 </span>            :        BOOST_STATIC_ASSERT ( ::boost::mpl::not_&lt;is_reference_predicate&gt;::value ) ;
<span class="lineNum">     544 </span>            :        factory.apply(m_storage.address()) ;
<span class="lineNum">     545 </span>            :        m_initialized = true ;
<span class="lineNum">     546 </span>            :      }
<span class="lineNum">     547 </span>            : 
<span class="lineNum">     548 </span>            :     template&lt;class Expr&gt;
<span class="lineNum">     549 </span>            :     void assign_expr_to_initialized ( Expr&amp;&amp; factory, in_place_factory_base const* tag )
<span class="lineNum">     550 </span>            :      {
<span class="lineNum">     551 </span>            :        destroy();
<span class="lineNum">     552 </span>            :        construct(factory,tag);
<span class="lineNum">     553 </span>            :      }
<span class="lineNum">     554 </span>            : 
<span class="lineNum">     555 </span>            :     // Constructs in-place using the given typed factory
<span class="lineNum">     556 </span>            :     template&lt;class Expr&gt;
<span class="lineNum">     557 </span>            :     void assign_expr_to_initialized ( Expr&amp;&amp; factory, typed_in_place_factory_base const* tag )
<span class="lineNum">     558 </span>            :      {
<span class="lineNum">     559 </span>            :        destroy();
<span class="lineNum">     560 </span>            :        construct(factory,tag);
<span class="lineNum">     561 </span>            :      }
<span class="lineNum">     562 </span>            : 
<span class="lineNum">     563 </span>            : #else
<span class="lineNum">     564 </span>            :     // Constructs in-place using the given factory
<span class="lineNum">     565 </span>            :     template&lt;class Expr&gt;
<span class="lineNum">     566 </span>            :     void construct ( Expr const&amp; factory, in_place_factory_base const* )
<span class="lineNum">     567 </span>            :      {
<span class="lineNum">     568 </span>            :        BOOST_STATIC_ASSERT ( ::boost::mpl::not_&lt;is_reference_predicate&gt;::value ) ;
<span class="lineNum">     569 </span>            :        boost_optional_detail::construct&lt;value_type&gt;(factory, m_storage.address());
<span class="lineNum">     570 </span>            :        m_initialized = true ;
<span class="lineNum">     571 </span>            :      }
<span class="lineNum">     572 </span>            : 
<span class="lineNum">     573 </span>            :     // Constructs in-place using the given typed factory
<span class="lineNum">     574 </span>            :     template&lt;class Expr&gt;
<span class="lineNum">     575 </span>            :     void construct ( Expr const&amp; factory, typed_in_place_factory_base const* )
<span class="lineNum">     576 </span>            :      {
<span class="lineNum">     577 </span>            :        BOOST_STATIC_ASSERT ( ::boost::mpl::not_&lt;is_reference_predicate&gt;::value ) ;
<span class="lineNum">     578 </span>            :        factory.apply(m_storage.address()) ;
<span class="lineNum">     579 </span>            :        m_initialized = true ;
<span class="lineNum">     580 </span>            :      }
<span class="lineNum">     581 </span>            : 
<span class="lineNum">     582 </span>            :     template&lt;class Expr&gt;
<span class="lineNum">     583 </span>            :     void assign_expr_to_initialized ( Expr const&amp; factory, in_place_factory_base const* tag )
<span class="lineNum">     584 </span>            :      {
<span class="lineNum">     585 </span>            :        destroy();
<span class="lineNum">     586 </span>            :        construct(factory,tag);
<span class="lineNum">     587 </span>            :      }
<span class="lineNum">     588 </span>            : 
<span class="lineNum">     589 </span>            :     // Constructs in-place using the given typed factory
<span class="lineNum">     590 </span>            :     template&lt;class Expr&gt;
<span class="lineNum">     591 </span>            :     void assign_expr_to_initialized ( Expr const&amp; factory, typed_in_place_factory_base const* tag )
<span class="lineNum">     592 </span>            :      {
<span class="lineNum">     593 </span>            :        destroy();
<span class="lineNum">     594 </span>            :        construct(factory,tag);
<span class="lineNum">     595 </span>            :      }
<span class="lineNum">     596 </span>            : #endif
<span class="lineNum">     597 </span>            : 
<span class="lineNum">     598 </span>            : #endif
<span class="lineNum">     599 </span>            : 
<span class="lineNum">     600 </span>            : #ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
<span class="lineNum">     601 </span>            :     // Constructs using any expression implicitly convertible to the single argument
<span class="lineNum">     602 </span>            :     // of a one-argument T constructor.
<span class="lineNum">     603 </span>            :     // Converting constructions of optional&lt;T&gt; from optional&lt;U&gt; uses this function with
<span class="lineNum">     604 </span>            :     // 'Expr' being of type 'U' and relying on a converting constructor of T from U.
<span class="lineNum">     605 </span>            :     template&lt;class Expr&gt;
<span class="lineNum">     606 </span>            :     void construct ( Expr&amp;&amp; expr, void const* )
<span class="lineNum">     607 </span>            :     {
<span class="lineNum">     608 </span>            :       new (m_storage.address()) internal_type(boost::forward&lt;Expr&gt;(expr)) ;
<span class="lineNum">     609 </span>            :       m_initialized = true ;
<span class="lineNum">     610 </span>            :     }
<span class="lineNum">     611 </span>            : 
<span class="lineNum">     612 </span>            :     // Assigns using a form any expression implicitly convertible to the single argument
<span class="lineNum">     613 </span>            :     // of a T's assignment operator.
<span class="lineNum">     614 </span>            :     // Converting assignments of optional&lt;T&gt; from optional&lt;U&gt; uses this function with
<span class="lineNum">     615 </span>            :     // 'Expr' being of type 'U' and relying on a converting assignment of T from U.
<span class="lineNum">     616 </span>            :     template&lt;class Expr&gt;
<span class="lineNum">     617 </span>            :     void assign_expr_to_initialized ( Expr&amp;&amp; expr, void const* )
<span class="lineNum">     618 </span>            :     {
<span class="lineNum">     619 </span>            :       assign_value(boost::forward&lt;Expr&gt;(expr), is_reference_predicate());
<span class="lineNum">     620 </span>            :     }
<span class="lineNum">     621 </span>            : #else
<span class="lineNum">     622 </span>            :     // Constructs using any expression implicitly convertible to the single argument
<span class="lineNum">     623 </span>            :     // of a one-argument T constructor.
<span class="lineNum">     624 </span>            :     // Converting constructions of optional&lt;T&gt; from optional&lt;U&gt; uses this function with
<span class="lineNum">     625 </span>            :     // 'Expr' being of type 'U' and relying on a converting constructor of T from U.
<span class="lineNum">     626 </span>            :     template&lt;class Expr&gt;
<span class="lineNum">     627 </span>            :     void construct ( Expr const&amp; expr, void const* )
<span class="lineNum">     628 </span>            :      {
<span class="lineNum">     629 </span>            :        new (m_storage.address()) internal_type(expr) ;
<span class="lineNum">     630 </span>            :        m_initialized = true ;
<span class="lineNum">     631 </span>            :      }
<span class="lineNum">     632 </span>            : 
<span class="lineNum">     633 </span>            :     // Assigns using a form any expression implicitly convertible to the single argument
<span class="lineNum">     634 </span>            :     // of a T's assignment operator.
<span class="lineNum">     635 </span>            :     // Converting assignments of optional&lt;T&gt; from optional&lt;U&gt; uses this function with
<span class="lineNum">     636 </span>            :     // 'Expr' being of type 'U' and relying on a converting assignment of T from U.
<span class="lineNum">     637 </span>            :     template&lt;class Expr&gt;
<span class="lineNum">     638 </span>            :     void assign_expr_to_initialized ( Expr const&amp; expr, void const* )
<span class="lineNum">     639 </span>            :      {
<span class="lineNum">     640 </span>            :        assign_value(expr, is_reference_predicate());
<span class="lineNum">     641 </span>            :      }
<span class="lineNum">     642 </span>            : 
<span class="lineNum">     643 </span>            : #endif
<span class="lineNum">     644 </span>            : 
<span class="lineNum">     645 </span>            : #ifdef BOOST_OPTIONAL_WEAK_OVERLOAD_RESOLUTION
<span class="lineNum">     646 </span>            :     // BCB5.64 (and probably lower versions) workaround.
<span class="lineNum">     647 </span>            :     //   The in-place factories are supported by means of catch-all constructors
<span class="lineNum">     648 </span>            :     //   and assignment operators (the functions are parameterized in terms of
<span class="lineNum">     649 </span>            :     //   an arbitrary 'Expr' type)
<span class="lineNum">     650 </span>            :     //   This compiler incorrectly resolves the overload set and sinks optional&lt;T&gt; and optional&lt;U&gt;
<span class="lineNum">     651 </span>            :     //   to the 'Expr'-taking functions even though explicit overloads are present for them.
<span class="lineNum">     652 </span>            :     //   Thus, the following overload is needed to properly handle the case when the 'lhs'
<span class="lineNum">     653 </span>            :     //   is another optional.
<span class="lineNum">     654 </span>            :     //
<span class="lineNum">     655 </span>            :     // For VC&lt;=70 compilers this workaround dosen't work becasue the comnpiler issues and error
<span class="lineNum">     656 </span>            :     // instead of choosing the wrong overload
<span class="lineNum">     657 </span>            :     //
<span class="lineNum">     658 </span>            : #ifndef  BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
<span class="lineNum">     659 </span>            :     // Notice that 'Expr' will be optional&lt;T&gt; or optional&lt;U&gt; (but not optional_base&lt;..&gt;)
<span class="lineNum">     660 </span>            :     template&lt;class Expr&gt;
<span class="lineNum">     661 </span>            :     void construct ( Expr&amp;&amp; expr, optional_tag const* )
<span class="lineNum">     662 </span>            :      {
<span class="lineNum">     663 </span>            :        if ( expr.is_initialized() )
<span class="lineNum">     664 </span>            :        {
<span class="lineNum">     665 </span>            :          // An exception can be thrown here.
<span class="lineNum">     666 </span>            :          // It it happens, THIS will be left uninitialized.
<span class="lineNum">     667 </span>            :          new (m_storage.address()) internal_type(types::move(expr.get())) ;
<span class="lineNum">     668 </span>            :          m_initialized = true ;
<span class="lineNum">     669 </span>            :        }
<span class="lineNum">     670 </span>            :      }
<span class="lineNum">     671 </span>            : #else
<span class="lineNum">     672 </span>            :     // Notice that 'Expr' will be optional&lt;T&gt; or optional&lt;U&gt; (but not optional_base&lt;..&gt;)
<span class="lineNum">     673 </span>            :     template&lt;class Expr&gt;
<span class="lineNum">     674 </span>            :     void construct ( Expr const&amp; expr, optional_tag const* )
<span class="lineNum">     675 </span>            :      {
<span class="lineNum">     676 </span>            :        if ( expr.is_initialized() )
<span class="lineNum">     677 </span>            :        {
<span class="lineNum">     678 </span>            :          // An exception can be thrown here.
<span class="lineNum">     679 </span>            :          // It it happens, THIS will be left uninitialized.
<span class="lineNum">     680 </span>            :          new (m_storage.address()) internal_type(expr.get()) ;
<span class="lineNum">     681 </span>            :          m_initialized = true ;
<span class="lineNum">     682 </span>            :        }
<span class="lineNum">     683 </span>            :      }
<span class="lineNum">     684 </span>            : #endif
<span class="lineNum">     685 </span>            : #endif // defined BOOST_OPTIONAL_WEAK_OVERLOAD_RESOLUTION
<span class="lineNum">     686 </span>            : 
<span class="lineNum">     687 </span><span class="lineNoCov">          0 :     void assign_value ( argument_type val, is_not_reference_tag ) { get_impl() = val; }</span>
<span class="lineNum">     688 </span>            :     void assign_value ( argument_type val, is_reference_tag     ) { construct(val); }
<span class="lineNum">     689 </span>            : #ifndef  BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
<span class="lineNum">     690 </span>            :     void assign_value ( rval_reference_type val, is_not_reference_tag ) { get_impl() = static_cast&lt;rval_reference_type&gt;(val); }
<span class="lineNum">     691 </span>            :     void assign_value ( rval_reference_type val, is_reference_tag     ) { construct( static_cast&lt;rval_reference_type&gt;(val) ); }
<span class="lineNum">     692 </span>            : #endif
<span class="lineNum">     693 </span>            : 
<span class="lineNum">     694 </span>            :     void destroy()
<span class="lineNum">     695 </span>            :     {
<span class="lineNum">     696 </span><span class="lineNoCov">          0 :       if ( m_initialized )</span>
<span class="lineNum">     697 </span>            :         destroy_impl(is_reference_predicate()) ;
<span class="lineNum">     698 </span>            :     }
<span class="lineNum">     699 </span>            : 
<span class="lineNum">     700 </span>            :     reference_const_type get_impl() const { return dereference(get_object(), is_reference_predicate() ) ; }
<span class="lineNum">     701 </span>            :     reference_type       get_impl()       { return dereference(get_object(), is_reference_predicate() ) ; }
<span class="lineNum">     702 </span>            : 
<span class="lineNum">     703 </span>            :     pointer_const_type get_ptr_impl() const { return cast_ptr(get_object(), is_reference_predicate() ) ; }
<span class="lineNum">     704 </span>            :     pointer_type       get_ptr_impl()       { return cast_ptr(get_object(), is_reference_predicate() ) ; }
<span class="lineNum">     705 </span>            : 
<span class="lineNum">     706 </span>            :   private :
<span class="lineNum">     707 </span>            : 
<span class="lineNum">     708 </span>            :     // internal_type can be either T or reference_content&lt;T&gt;
<span class="lineNum">     709 </span>            : #if defined(BOOST_OPTIONAL_DETAIL_USE_ATTRIBUTE_MAY_ALIAS)
<span class="lineNum">     710 </span>            :     // This workaround is supposed to silence GCC warnings about broken strict aliasing rules
<span class="lineNum">     711 </span>            :     internal_type const* get_object() const
<span class="lineNum">     712 </span>            :     {
<span class="lineNum">     713 </span>            :         union { void const* ap_pvoid; internal_type const* as_ptype; } caster = { m_storage.address() };
<span class="lineNum">     714 </span>            :         return caster.as_ptype;
<span class="lineNum">     715 </span>            :     }
<span class="lineNum">     716 </span>            :     internal_type *      get_object()
<span class="lineNum">     717 </span>            :     {
<span class="lineNum">     718 </span>            :         union { void* ap_pvoid; internal_type* as_ptype; } caster = { m_storage.address() };
<span class="lineNum">     719 </span>            :         return caster.as_ptype;
<span class="lineNum">     720 </span>            :     }
<span class="lineNum">     721 </span>            : #else
<span class="lineNum">     722 </span>            :     internal_type const* get_object() const { return static_cast&lt;internal_type const*&gt;(m_storage.address()); }
<span class="lineNum">     723 </span>            :     internal_type *      get_object()       { return static_cast&lt;internal_type *&gt;     (m_storage.address()); }
<span class="lineNum">     724 </span>            : #endif
<span class="lineNum">     725 </span>            : 
<span class="lineNum">     726 </span>            :     // reference_content&lt;T&gt; lacks an implicit conversion to T&amp;, so the following is needed to obtain a proper reference.
<span class="lineNum">     727 </span>            :     reference_const_type dereference( internal_type const* p, is_not_reference_tag ) const { return *p ; }
<span class="lineNum">     728 </span>            :     reference_type       dereference( internal_type*       p, is_not_reference_tag )       { return *p ; }
<span class="lineNum">     729 </span>            :     reference_const_type dereference( internal_type const* p, is_reference_tag     ) const { return p-&gt;get() ; }
<span class="lineNum">     730 </span>            :     reference_type       dereference( internal_type*       p, is_reference_tag     )       { return p-&gt;get() ; }
<span class="lineNum">     731 </span>            : 
<span class="lineNum">     732 </span>            : #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x581))
<span class="lineNum">     733 </span>            :     void destroy_impl ( is_not_reference_tag ) { get_ptr_impl()-&gt;internal_type::~internal_type() ; m_initialized = false ; }
<span class="lineNum">     734 </span>            : #else
<span class="lineNum">     735 </span><span class="lineNoCov">          0 :     void destroy_impl ( is_not_reference_tag ) { get_ptr_impl()-&gt;~T() ; m_initialized = false ; }</span>
<span class="lineNum">     736 </span>            : #endif
<span class="lineNum">     737 </span>            : 
<span class="lineNum">     738 </span>            :     void destroy_impl ( is_reference_tag     ) { m_initialized = false ; }
<span class="lineNum">     739 </span>            : 
<span class="lineNum">     740 </span>            :     // If T is of reference type, trying to get a pointer to the held value must result in a compile-time error.
<span class="lineNum">     741 </span>            :     // Decent compilers should disallow conversions from reference_content&lt;T&gt;* to T*, but just in case,
<span class="lineNum">     742 </span>            :     // the following olverloads are used to filter out the case and guarantee an error in case of T being a reference.
<span class="lineNum">     743 </span>            :     pointer_const_type cast_ptr( internal_type const* p, is_not_reference_tag ) const { return p ; }
<span class="lineNum">     744 </span>            :     pointer_type       cast_ptr( internal_type *      p, is_not_reference_tag )       { return p ; }
<span class="lineNum">     745 </span>            :     pointer_const_type cast_ptr( internal_type const* p, is_reference_tag     ) const { return &amp;p-&gt;get() ; }
<span class="lineNum">     746 </span>            :     pointer_type       cast_ptr( internal_type *      p, is_reference_tag     )       { return &amp;p-&gt;get() ; }
<span class="lineNum">     747 </span>            : 
<span class="lineNum">     748 </span>            :     bool m_initialized ;
<span class="lineNum">     749 </span>            :     storage_type m_storage ;
<span class="lineNum">     750 </span>            : } ;
<span class="lineNum">     751 </span>            : 
<span class="lineNum">     752 </span>            : } // namespace optional_detail
<span class="lineNum">     753 </span>            : 
<span class="lineNum">     754 </span>            : template&lt;class T&gt;
<span class="lineNum">     755 </span>            : class optional : public optional_detail::optional_base&lt;T&gt;
<span class="lineNum">     756 </span>            : {
<span class="lineNum">     757 </span>            :     typedef optional_detail::optional_base&lt;T&gt; base ;
<span class="lineNum">     758 </span>            : 
<span class="lineNum">     759 </span>            :   public :
<span class="lineNum">     760 </span>            : 
<span class="lineNum">     761 </span>            :     typedef optional&lt;T&gt; this_type ;
<span class="lineNum">     762 </span>            : 
<span class="lineNum">     763 </span>            :     typedef BOOST_DEDUCED_TYPENAME base::value_type           value_type ;
<span class="lineNum">     764 </span>            :     typedef BOOST_DEDUCED_TYPENAME base::reference_type       reference_type ;
<span class="lineNum">     765 </span>            :     typedef BOOST_DEDUCED_TYPENAME base::reference_const_type reference_const_type ;
<span class="lineNum">     766 </span>            : #ifndef  BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
<span class="lineNum">     767 </span>            :     typedef BOOST_DEDUCED_TYPENAME base::rval_reference_type  rval_reference_type ;
<span class="lineNum">     768 </span>            :     typedef BOOST_DEDUCED_TYPENAME base::reference_type_of_temporary_wrapper reference_type_of_temporary_wrapper ;
<span class="lineNum">     769 </span>            : #endif
<span class="lineNum">     770 </span>            :     typedef BOOST_DEDUCED_TYPENAME base::pointer_type         pointer_type ;
<span class="lineNum">     771 </span>            :     typedef BOOST_DEDUCED_TYPENAME base::pointer_const_type   pointer_const_type ;
<span class="lineNum">     772 </span>            :     typedef BOOST_DEDUCED_TYPENAME base::argument_type        argument_type ;
<span class="lineNum">     773 </span>            : 
<span class="lineNum">     774 </span>            :     // Creates an optional&lt;T&gt; uninitialized.
<span class="lineNum">     775 </span>            :     // No-throw
<span class="lineNum">     776 </span>            :     optional() BOOST_NOEXCEPT : base() {}
<span class="lineNum">     777 </span>            : 
<span class="lineNum">     778 </span>            :     // Creates an optional&lt;T&gt; uninitialized.
<span class="lineNum">     779 </span>            :     // No-throw
<span class="lineNum">     780 </span>            :     optional( none_t none_ ) BOOST_NOEXCEPT : base(none_) {}
<span class="lineNum">     781 </span>            : 
<span class="lineNum">     782 </span>            :     // Creates an optional&lt;T&gt; initialized with 'val'.
<span class="lineNum">     783 </span>            :     // Can throw if T::T(T const&amp;) does
<span class="lineNum">     784 </span>            :     optional ( argument_type val ) : base(val) {}
<span class="lineNum">     785 </span>            : 
<span class="lineNum">     786 </span>            : #ifndef  BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
<span class="lineNum">     787 </span>            :     // Creates an optional&lt;T&gt; initialized with 'move(val)'.
<span class="lineNum">     788 </span>            :     // Can throw if T::T(T &amp;&amp;) does
<span class="lineNum">     789 </span>            :     optional ( rval_reference_type val ) : base( boost::forward&lt;T&gt;(val) ) 
<span class="lineNum">     790 </span>            :       {optional_detail::prevent_binding_rvalue_ref_to_optional_lvalue_ref&lt;T, rval_reference_type&gt;();}
<span class="lineNum">     791 </span>            : #endif
<span class="lineNum">     792 </span>            : 
<span class="lineNum">     793 </span>            :     // Creates an optional&lt;T&gt; initialized with 'val' IFF cond is true, otherwise creates an uninitialized optional.
<span class="lineNum">     794 </span>            :     // Can throw if T::T(T const&amp;) does
<span class="lineNum">     795 </span>            :     optional ( bool cond, argument_type val ) : base(cond,val) {}
<span class="lineNum">     796 </span>            : 
<span class="lineNum">     797 </span>            :     // NOTE: MSVC needs templated versions first
<span class="lineNum">     798 </span>            : 
<span class="lineNum">     799 </span>            :     // Creates a deep copy of another convertible optional&lt;U&gt;
<span class="lineNum">     800 </span>            :     // Requires a valid conversion from U to T.
<span class="lineNum">     801 </span>            :     // Can throw if T::T(U const&amp;) does
<span class="lineNum">     802 </span>            :     template&lt;class U&gt;
<span class="lineNum">     803 </span>            :     explicit optional ( optional&lt;U&gt; const&amp; rhs )
<span class="lineNum">     804 </span>            :       :
<span class="lineNum">     805 </span>            :       base()
<span class="lineNum">     806 </span>            :     {
<span class="lineNum">     807 </span>            :       if ( rhs.is_initialized() )
<span class="lineNum">     808 </span>            :         this-&gt;construct(rhs.get());
<span class="lineNum">     809 </span>            :     }
<span class="lineNum">     810 </span>            :     
<span class="lineNum">     811 </span>            : #ifndef  BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
<span class="lineNum">     812 </span>            :     // Creates a deep move of another convertible optional&lt;U&gt;
<span class="lineNum">     813 </span>            :     // Requires a valid conversion from U to T.
<span class="lineNum">     814 </span>            :     // Can throw if T::T(U&amp;&amp;) does
<span class="lineNum">     815 </span>            :     template&lt;class U&gt;
<span class="lineNum">     816 </span>            :     explicit optional ( optional&lt;U&gt; &amp;&amp; rhs )
<span class="lineNum">     817 </span>            :       :
<span class="lineNum">     818 </span>            :       base()
<span class="lineNum">     819 </span>            :     {
<span class="lineNum">     820 </span>            :       if ( rhs.is_initialized() )
<span class="lineNum">     821 </span>            :         this-&gt;construct( boost::move(rhs.get()) );
<span class="lineNum">     822 </span>            :     }
<span class="lineNum">     823 </span>            : #endif
<span class="lineNum">     824 </span>            : 
<span class="lineNum">     825 </span>            : #ifndef BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT
<span class="lineNum">     826 </span>            :     // Creates an optional&lt;T&gt; with an expression which can be either
<span class="lineNum">     827 </span>            :     //  (a) An instance of InPlaceFactory (i.e. in_place(a,b,...,n);
<span class="lineNum">     828 </span>            :     //  (b) An instance of TypedInPlaceFactory ( i.e. in_place&lt;T&gt;(a,b,...,n);
<span class="lineNum">     829 </span>            :     //  (c) Any expression implicitly convertible to the single type
<span class="lineNum">     830 </span>            :     //      of a one-argument T's constructor.
<span class="lineNum">     831 </span>            :     //  (d*) Weak compilers (BCB) might also resolved Expr as optional&lt;T&gt; and optional&lt;U&gt;
<span class="lineNum">     832 </span>            :     //       even though explicit overloads are present for these.
<span class="lineNum">     833 </span>            :     // Depending on the above some T ctor is called.
<span class="lineNum">     834 </span>            :     // Can throw if the resolved T ctor throws.
<span class="lineNum">     835 </span>            : #ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
<span class="lineNum">     836 </span>            : 
<span class="lineNum">     837 </span>            : 
<span class="lineNum">     838 </span>            :   template&lt;class Expr&gt;
<span class="lineNum">     839 </span>            :   explicit optional ( Expr&amp;&amp; expr, 
<span class="lineNum">     840 </span>            :                       BOOST_DEDUCED_TYPENAME boost::disable_if_c&lt;
<span class="lineNum">     841 </span>            :                         (boost::is_base_of&lt;optional_detail::optional_tag, BOOST_DEDUCED_TYPENAME boost::decay&lt;Expr&gt;::type&gt;::value) || 
<span class="lineNum">     842 </span>            :                         boost::is_same&lt;BOOST_DEDUCED_TYPENAME boost::decay&lt;Expr&gt;::type, none_t&gt;::value &gt;::type* = 0 
<span class="lineNum">     843 </span>            :   ) 
<span class="lineNum">     844 </span>            :     : base(boost::forward&lt;Expr&gt;(expr),boost::addressof(expr)) 
<span class="lineNum">     845 </span>            :     {optional_detail::prevent_binding_rvalue_ref_to_optional_lvalue_ref&lt;T, Expr&amp;&amp;&gt;();}
<span class="lineNum">     846 </span>            : 
<span class="lineNum">     847 </span>            : #else
<span class="lineNum">     848 </span>            :     template&lt;class Expr&gt;
<span class="lineNum">     849 </span>            :     explicit optional ( Expr const&amp; expr ) : base(expr,boost::addressof(expr)) {}
<span class="lineNum">     850 </span>            : #endif // !defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
<span class="lineNum">     851 </span>            : #endif // !defined BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT
<span class="lineNum">     852 </span>            : 
<span class="lineNum">     853 </span>            :     // Creates a deep copy of another optional&lt;T&gt;
<span class="lineNum">     854 </span>            :     // Can throw if T::T(T const&amp;) does
<span class="lineNum">     855 </span>            :     optional ( optional const&amp; rhs ) : base( static_cast&lt;base const&amp;&gt;(rhs) ) {}
<span class="lineNum">     856 </span>            : 
<span class="lineNum">     857 </span>            : #ifndef  BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
<span class="lineNum">     858 </span>            :         // Creates a deep move of another optional&lt;T&gt;
<span class="lineNum">     859 </span>            :         // Can throw if T::T(T&amp;&amp;) does
<span class="lineNum">     860 </span>            :         optional ( optional &amp;&amp; rhs ) 
<span class="lineNum">     861 </span>            :           BOOST_NOEXCEPT_IF(::boost::is_nothrow_move_constructible&lt;T&gt;::value)
<span class="lineNum">     862 </span>            :           : base( boost::move(rhs) ) 
<span class="lineNum">     863 </span>            :         {}
<span class="lineNum">     864 </span>            : 
<span class="lineNum">     865 </span>            : #endif
<span class="lineNum">     866 </span>            :    // No-throw (assuming T::~T() doesn't)
<span class="lineNum">     867 </span><span class="lineNoCov">          0 :     ~optional() {}</span>
<span class="lineNum">     868 </span>            : 
<span class="lineNum">     869 </span>            : #if !defined(BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT) &amp;&amp; !defined(BOOST_OPTIONAL_WEAK_OVERLOAD_RESOLUTION)
<span class="lineNum">     870 </span>            :     // Assigns from an expression. See corresponding constructor.
<span class="lineNum">     871 </span>            :     // Basic Guarantee: If the resolved T ctor throws, this is left UNINITIALIZED
<span class="lineNum">     872 </span>            : #ifndef  BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
<span class="lineNum">     873 </span>            : 
<span class="lineNum">     874 </span>            :     template&lt;class Expr&gt;
<span class="lineNum">     875 </span>            :     BOOST_DEDUCED_TYPENAME boost::disable_if_c&lt;
<span class="lineNum">     876 </span>            :       boost::is_base_of&lt;optional_detail::optional_tag, BOOST_DEDUCED_TYPENAME boost::decay&lt;Expr&gt;::type&gt;::value || 
<span class="lineNum">     877 </span>            :         boost::is_same&lt;BOOST_DEDUCED_TYPENAME boost::decay&lt;Expr&gt;::type, none_t&gt;::value,
<span class="lineNum">     878 </span>            :       optional&amp;
<span class="lineNum">     879 </span>            :     &gt;::type 
<span class="lineNum">     880 </span>            :     operator= ( Expr&amp;&amp; expr )
<span class="lineNum">     881 </span>            :       {
<span class="lineNum">     882 </span>            :         optional_detail::prevent_binding_rvalue_ref_to_optional_lvalue_ref&lt;T, Expr&amp;&amp;&gt;();
<span class="lineNum">     883 </span>            :         this-&gt;assign_expr(boost::forward&lt;Expr&gt;(expr),boost::addressof(expr));
<span class="lineNum">     884 </span>            :         return *this ;
<span class="lineNum">     885 </span>            :       }
<span class="lineNum">     886 </span>            : 
<span class="lineNum">     887 </span>            : #else
<span class="lineNum">     888 </span>            :     template&lt;class Expr&gt;
<span class="lineNum">     889 </span>            :     optional&amp; operator= ( Expr const&amp; expr )
<span class="lineNum">     890 </span>            :       {
<span class="lineNum">     891 </span>            :         this-&gt;assign_expr(expr,boost::addressof(expr));
<span class="lineNum">     892 </span>            :         return *this ;
<span class="lineNum">     893 </span>            :       }
<span class="lineNum">     894 </span>            : #endif // !defined  BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
<span class="lineNum">     895 </span>            : #endif // !defined(BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT) &amp;&amp; !defined(BOOST_OPTIONAL_WEAK_OVERLOAD_RESOLUTION)
<span class="lineNum">     896 </span>            : 
<span class="lineNum">     897 </span>            :     // Copy-assigns from another convertible optional&lt;U&gt; (converts &amp;&amp; deep-copies the rhs value)
<span class="lineNum">     898 </span>            :     // Requires a valid conversion from U to T.
<span class="lineNum">     899 </span>            :     // Basic Guarantee: If T::T( U const&amp; ) throws, this is left UNINITIALIZED
<span class="lineNum">     900 </span>            :     template&lt;class U&gt;
<span class="lineNum">     901 </span>            :     optional&amp; operator= ( optional&lt;U&gt; const&amp; rhs )
<span class="lineNum">     902 </span>            :       {
<span class="lineNum">     903 </span>            :         this-&gt;assign(rhs);
<span class="lineNum">     904 </span>            :         return *this ;
<span class="lineNum">     905 </span>            :       }
<span class="lineNum">     906 </span>            :       
<span class="lineNum">     907 </span>            : #ifndef  BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
<span class="lineNum">     908 </span>            :     // Move-assigns from another convertible optional&lt;U&gt; (converts &amp;&amp; deep-moves the rhs value)
<span class="lineNum">     909 </span>            :     // Requires a valid conversion from U to T.
<span class="lineNum">     910 </span>            :     // Basic Guarantee: If T::T( U &amp;&amp; ) throws, this is left UNINITIALIZED
<span class="lineNum">     911 </span>            :     template&lt;class U&gt;
<span class="lineNum">     912 </span>            :     optional&amp; operator= ( optional&lt;U&gt; &amp;&amp; rhs )
<span class="lineNum">     913 </span>            :       {
<span class="lineNum">     914 </span>            :         this-&gt;assign(boost::move(rhs));
<span class="lineNum">     915 </span>            :         return *this ;
<span class="lineNum">     916 </span>            :       }
<span class="lineNum">     917 </span>            : #endif
<span class="lineNum">     918 </span>            : 
<span class="lineNum">     919 </span>            :     // Assigns from another optional&lt;T&gt; (deep-copies the rhs value)
<span class="lineNum">     920 </span>            :     // Basic Guarantee: If T::T( T const&amp; ) throws, this is left UNINITIALIZED
<span class="lineNum">     921 </span>            :     //  (NOTE: On BCB, this operator is not actually called and left is left UNMODIFIED in case of a throw)
<span class="lineNum">     922 </span>            :     optional&amp; operator= ( optional const&amp; rhs )
<span class="lineNum">     923 </span>            :       {
<span class="lineNum">     924 </span><span class="lineNoCov">          0 :         this-&gt;assign( static_cast&lt;base const&amp;&gt;(rhs) ) ;</span>
<span class="lineNum">     925 </span>            :         return *this ;
<span class="lineNum">     926 </span>            :       }
<span class="lineNum">     927 </span>            : 
<span class="lineNum">     928 </span>            : #ifndef  BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
<span class="lineNum">     929 </span>            :     // Assigns from another optional&lt;T&gt; (deep-moves the rhs value)
<span class="lineNum">     930 </span>            :     optional&amp; operator= ( optional &amp;&amp; rhs ) 
<span class="lineNum">     931 </span>            :           BOOST_NOEXCEPT_IF(::boost::is_nothrow_move_constructible&lt;T&gt;::value &amp;&amp; ::boost::is_nothrow_move_assignable&lt;T&gt;::value)
<span class="lineNum">     932 </span>            :       {
<span class="lineNum">     933 </span>            :         this-&gt;assign( static_cast&lt;base &amp;&amp;&gt;(rhs) ) ;
<span class="lineNum">     934 </span>            :         return *this ;
<span class="lineNum">     935 </span>            :       }
<span class="lineNum">     936 </span>            : #endif
<span class="lineNum">     937 </span>            : 
<span class="lineNum">     938 </span>            :     // Assigns from a T (deep-copies the rhs value)
<span class="lineNum">     939 </span>            :     // Basic Guarantee: If T::( T const&amp; ) throws, this is left UNINITIALIZED
<span class="lineNum">     940 </span>            :     optional&amp; operator= ( argument_type val )
<span class="lineNum">     941 </span>            :       {
<span class="lineNum">     942 </span>            :         this-&gt;assign( val ) ;
<span class="lineNum">     943 </span>            :         return *this ;
<span class="lineNum">     944 </span>            :       }
<span class="lineNum">     945 </span>            : 
<span class="lineNum">     946 </span>            : #ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
<span class="lineNum">     947 </span>            :     // Assigns from a T (deep-moves the rhs value)
<span class="lineNum">     948 </span>            :     optional&amp; operator= ( rval_reference_type val )
<span class="lineNum">     949 </span>            :       {
<span class="lineNum">     950 </span>            :         optional_detail::prevent_binding_rvalue_ref_to_optional_lvalue_ref&lt;T, rval_reference_type&gt;();
<span class="lineNum">     951 </span>            :         this-&gt;assign( boost::move(val) ) ;
<span class="lineNum">     952 </span>            :         return *this ;
<span class="lineNum">     953 </span>            :       }
<span class="lineNum">     954 </span>            : #endif
<span class="lineNum">     955 </span>            : 
<span class="lineNum">     956 </span>            :     // Assigns from a &quot;none&quot;
<span class="lineNum">     957 </span>            :     // Which destroys the current value, if any, leaving this UNINITIALIZED
<span class="lineNum">     958 </span>            :     // No-throw (assuming T::~T() doesn't)
<span class="lineNum">     959 </span>            :     optional&amp; operator= ( none_t none_ ) BOOST_NOEXCEPT
<span class="lineNum">     960 </span>            :       {
<span class="lineNum">     961 </span>            :         this-&gt;assign( none_ ) ;
<span class="lineNum">     962 </span>            :         return *this ;
<span class="lineNum">     963 </span>            :       }
<span class="lineNum">     964 </span>            :       
<span class="lineNum">     965 </span>            : #if (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES) &amp;&amp; (!defined BOOST_NO_CXX11_VARIADIC_TEMPLATES)
<span class="lineNum">     966 </span>            :     // Constructs in-place
<span class="lineNum">     967 </span>            :     // upon exception *this is always uninitialized
<span class="lineNum">     968 </span>            :     template&lt;class... Args&gt;
<span class="lineNum">     969 </span>            :     void emplace ( Args&amp;&amp;... args )
<span class="lineNum">     970 </span>            :      {
<span class="lineNum">     971 </span>            :        this-&gt;emplace_assign( boost::forward&lt;Args&gt;(args)... );
<span class="lineNum">     972 </span>            :      }
<span class="lineNum">     973 </span>            : #elif (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES)
<span class="lineNum">     974 </span>            :     template&lt;class Arg&gt;
<span class="lineNum">     975 </span>            :     void emplace ( Arg&amp;&amp; arg )
<span class="lineNum">     976 </span>            :      {
<span class="lineNum">     977 </span>            :        this-&gt;emplace_assign( boost::forward&lt;Arg&gt;(arg) );
<span class="lineNum">     978 </span>            :      }
<span class="lineNum">     979 </span>            : #else
<span class="lineNum">     980 </span>            :     template&lt;class Arg&gt;
<span class="lineNum">     981 </span>            :     void emplace ( const Arg&amp; arg )
<span class="lineNum">     982 </span>            :      {
<span class="lineNum">     983 </span>            :        this-&gt;emplace_assign( arg );
<span class="lineNum">     984 </span>            :      }
<span class="lineNum">     985 </span>            :      
<span class="lineNum">     986 </span>            :     template&lt;class Arg&gt;
<span class="lineNum">     987 </span>            :     void emplace ( Arg&amp; arg )
<span class="lineNum">     988 </span>            :      {
<span class="lineNum">     989 </span>            :        this-&gt;emplace_assign( arg );
<span class="lineNum">     990 </span>            :      }
<span class="lineNum">     991 </span>            : #endif
<span class="lineNum">     992 </span>            : 
<span class="lineNum">     993 </span>            :     void swap( optional &amp; arg )
<span class="lineNum">     994 </span>            :           BOOST_NOEXCEPT_IF(::boost::is_nothrow_move_constructible&lt;T&gt;::value &amp;&amp; ::boost::is_nothrow_move_assignable&lt;T&gt;::value)
<span class="lineNum">     995 </span>            :       {
<span class="lineNum">     996 </span>            :         // allow for Koenig lookup
<span class="lineNum">     997 </span>            :         boost::swap(*this, arg);
<span class="lineNum">     998 </span>            :       }
<span class="lineNum">     999 </span>            : 
<span class="lineNum">    1000 </span>            : 
<span class="lineNum">    1001 </span>            :     // Returns a reference to the value if this is initialized, otherwise,
<span class="lineNum">    1002 </span>            :     // the behaviour is UNDEFINED
<span class="lineNum">    1003 </span>            :     // No-throw
<span class="lineNum">    1004 </span>            :     reference_const_type get() const { BOOST_ASSERT(this-&gt;is_initialized()) ; return this-&gt;get_impl(); }
<span class="lineNum">    1005 </span>            :     reference_type       get()       { BOOST_ASSERT(this-&gt;is_initialized()) ; return this-&gt;get_impl(); }
<span class="lineNum">    1006 </span>            : 
<span class="lineNum">    1007 </span>            :     // Returns a copy of the value if this is initialized, 'v' otherwise
<span class="lineNum">    1008 </span>            :     reference_const_type get_value_or ( reference_const_type v ) const { return this-&gt;is_initialized() ? get() : v ; }
<span class="lineNum">    1009 </span>            :     reference_type       get_value_or ( reference_type       v )       { return this-&gt;is_initialized() ? get() : v ; }
<span class="lineNum">    1010 </span>            : 
<span class="lineNum">    1011 </span>            :     // Returns a pointer to the value if this is initialized, otherwise,
<span class="lineNum">    1012 </span>            :     // the behaviour is UNDEFINED
<span class="lineNum">    1013 </span>            :     // No-throw
<span class="lineNum">    1014 </span>            :     pointer_const_type operator-&gt;() const { BOOST_ASSERT(this-&gt;is_initialized()) ; return this-&gt;get_ptr_impl() ; }
<span class="lineNum">    1015 </span>            :     pointer_type       operator-&gt;()       { BOOST_ASSERT(this-&gt;is_initialized()) ; return this-&gt;get_ptr_impl() ; }
<span class="lineNum">    1016 </span>            : 
<span class="lineNum">    1017 </span>            :     // Returns a reference to the value if this is initialized, otherwise,
<span class="lineNum">    1018 </span>            :     // the behaviour is UNDEFINED
<span class="lineNum">    1019 </span>            :     // No-throw
<span class="lineNum">    1020 </span>            : #if (!defined BOOST_NO_CXX11_REF_QUALIFIERS) &amp;&amp; (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES) 
<span class="lineNum">    1021 </span>            :     reference_const_type operator *() const&amp; { return this-&gt;get() ; }
<span class="lineNum">    1022 </span>            :     reference_type       operator *() &amp;      { return this-&gt;get() ; }
<span class="lineNum">    1023 </span>            :     reference_type_of_temporary_wrapper operator *() &amp;&amp; { return base::types::move(this-&gt;get()) ; }
<span class="lineNum">    1024 </span>            : #else
<span class="lineNum">    1025 </span>            :     reference_const_type operator *() const { return this-&gt;get() ; }
<span class="lineNum">    1026 </span>            :     reference_type       operator *()       { return this-&gt;get() ; }
<span class="lineNum">    1027 </span>            : #endif // !defined BOOST_NO_CXX11_REF_QUALIFIERS
<span class="lineNum">    1028 </span>            : 
<span class="lineNum">    1029 </span>            : #if (!defined BOOST_NO_CXX11_REF_QUALIFIERS) &amp;&amp; (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES) 
<span class="lineNum">    1030 </span>            :     reference_const_type value() const&amp;
<span class="lineNum">    1031 </span>            :       { 
<span class="lineNum">    1032 </span>            :         if (this-&gt;is_initialized())
<span class="lineNum">    1033 </span>            :           return this-&gt;get() ;
<span class="lineNum">    1034 </span>            :         else
<span class="lineNum">    1035 </span>            :           throw_exception(bad_optional_access());
<span class="lineNum">    1036 </span>            :       }
<span class="lineNum">    1037 </span>            :       
<span class="lineNum">    1038 </span>            :     reference_type value() &amp;
<span class="lineNum">    1039 </span>            :       { 
<span class="lineNum">    1040 </span>            :         if (this-&gt;is_initialized())
<span class="lineNum">    1041 </span>            :           return this-&gt;get() ;
<span class="lineNum">    1042 </span>            :         else
<span class="lineNum">    1043 </span>            :           throw_exception(bad_optional_access());
<span class="lineNum">    1044 </span>            :       }
<span class="lineNum">    1045 </span>            :       
<span class="lineNum">    1046 </span>            :     reference_type_of_temporary_wrapper value() &amp;&amp;
<span class="lineNum">    1047 </span>            :       { 
<span class="lineNum">    1048 </span>            :         if (this-&gt;is_initialized())
<span class="lineNum">    1049 </span>            :           return base::types::move(this-&gt;get()) ;
<span class="lineNum">    1050 </span>            :         else
<span class="lineNum">    1051 </span>            :           throw_exception(bad_optional_access());
<span class="lineNum">    1052 </span>            :       }
<span class="lineNum">    1053 </span>            : 
<span class="lineNum">    1054 </span>            : #else 
<span class="lineNum">    1055 </span>            :     reference_const_type value() const
<span class="lineNum">    1056 </span>            :       { 
<span class="lineNum">    1057 </span>            :         if (this-&gt;is_initialized())
<span class="lineNum">    1058 </span>            :           return this-&gt;get() ;
<span class="lineNum">    1059 </span>            :         else
<span class="lineNum">    1060 </span>            :           throw_exception(bad_optional_access());
<span class="lineNum">    1061 </span>            :       }
<span class="lineNum">    1062 </span>            :       
<span class="lineNum">    1063 </span>            :     reference_type value()
<span class="lineNum">    1064 </span>            :       { 
<span class="lineNum">    1065 </span>            :         if (this-&gt;is_initialized())
<span class="lineNum">    1066 </span>            :           return this-&gt;get() ;
<span class="lineNum">    1067 </span>            :         else
<span class="lineNum">    1068 </span>            :           throw_exception(bad_optional_access());
<span class="lineNum">    1069 </span>            :       }
<span class="lineNum">    1070 </span>            : #endif
<span class="lineNum">    1071 </span>            : 
<span class="lineNum">    1072 </span>            : 
<span class="lineNum">    1073 </span>            : #ifndef BOOST_NO_CXX11_REF_QUALIFIERS
<span class="lineNum">    1074 </span>            :     template &lt;class U&gt;
<span class="lineNum">    1075 </span>            :     value_type value_or ( U&amp;&amp; v ) const&amp;
<span class="lineNum">    1076 </span>            :       { 
<span class="lineNum">    1077 </span>            :         if (this-&gt;is_initialized())
<span class="lineNum">    1078 </span>            :           return get();
<span class="lineNum">    1079 </span>            :         else
<span class="lineNum">    1080 </span>            :           return boost::forward&lt;U&gt;(v);
<span class="lineNum">    1081 </span>            :       }
<span class="lineNum">    1082 </span>            :     
<span class="lineNum">    1083 </span>            :     template &lt;class U&gt;
<span class="lineNum">    1084 </span>            :     value_type value_or ( U&amp;&amp; v ) &amp;&amp; 
<span class="lineNum">    1085 </span>            :       { 
<span class="lineNum">    1086 </span>            :         if (this-&gt;is_initialized())
<span class="lineNum">    1087 </span>            :           return base::types::move(get());
<span class="lineNum">    1088 </span>            :         else
<span class="lineNum">    1089 </span>            :           return boost::forward&lt;U&gt;(v);
<span class="lineNum">    1090 </span>            :       }
<span class="lineNum">    1091 </span>            : #elif !defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
<span class="lineNum">    1092 </span>            :     template &lt;class U&gt;
<span class="lineNum">    1093 </span>            :     value_type value_or ( U&amp;&amp; v ) const 
<span class="lineNum">    1094 </span>            :       {
<span class="lineNum">    1095 </span>            :         if (this-&gt;is_initialized())
<span class="lineNum">    1096 </span>            :           return get();
<span class="lineNum">    1097 </span>            :         else
<span class="lineNum">    1098 </span>            :           return boost::forward&lt;U&gt;(v);
<span class="lineNum">    1099 </span>            :       }
<span class="lineNum">    1100 </span>            : #else
<span class="lineNum">    1101 </span>            :     template &lt;class U&gt;
<span class="lineNum">    1102 </span>            :     value_type value_or ( U const&amp; v ) const 
<span class="lineNum">    1103 </span>            :       { 
<span class="lineNum">    1104 </span>            :         if (this-&gt;is_initialized())
<span class="lineNum">    1105 </span>            :           return get();
<span class="lineNum">    1106 </span>            :         else
<span class="lineNum">    1107 </span>            :           return v;
<span class="lineNum">    1108 </span>            :       }
<span class="lineNum">    1109 </span>            :       
<span class="lineNum">    1110 </span>            :     template &lt;class U&gt;
<span class="lineNum">    1111 </span>            :     value_type value_or ( U&amp; v ) const 
<span class="lineNum">    1112 </span>            :       { 
<span class="lineNum">    1113 </span>            :         if (this-&gt;is_initialized())
<span class="lineNum">    1114 </span>            :           return get();
<span class="lineNum">    1115 </span>            :         else
<span class="lineNum">    1116 </span>            :           return v;
<span class="lineNum">    1117 </span>            :       }
<span class="lineNum">    1118 </span>            : #endif
<span class="lineNum">    1119 </span>            : 
<span class="lineNum">    1120 </span>            : 
<span class="lineNum">    1121 </span>            : #ifndef BOOST_NO_CXX11_REF_QUALIFIERS
<span class="lineNum">    1122 </span>            :     template &lt;typename F&gt;
<span class="lineNum">    1123 </span>            :     value_type value_or_eval ( F f ) const&amp;
<span class="lineNum">    1124 </span>            :       {
<span class="lineNum">    1125 </span>            :         if (this-&gt;is_initialized())
<span class="lineNum">    1126 </span>            :           return get();
<span class="lineNum">    1127 </span>            :         else
<span class="lineNum">    1128 </span>            :           return f();
<span class="lineNum">    1129 </span>            :       }
<span class="lineNum">    1130 </span>            :       
<span class="lineNum">    1131 </span>            :     template &lt;typename F&gt;
<span class="lineNum">    1132 </span>            :     value_type value_or_eval ( F f ) &amp;&amp;
<span class="lineNum">    1133 </span>            :       {
<span class="lineNum">    1134 </span>            :         if (this-&gt;is_initialized())
<span class="lineNum">    1135 </span>            :           return base::types::move(get());
<span class="lineNum">    1136 </span>            :         else
<span class="lineNum">    1137 </span>            :           return f();
<span class="lineNum">    1138 </span>            :       }
<span class="lineNum">    1139 </span>            : #else
<span class="lineNum">    1140 </span>            :     template &lt;typename F&gt;
<span class="lineNum">    1141 </span>            :     value_type value_or_eval ( F f ) const
<span class="lineNum">    1142 </span>            :       {
<span class="lineNum">    1143 </span>            :         if (this-&gt;is_initialized())
<span class="lineNum">    1144 </span>            :           return get();
<span class="lineNum">    1145 </span>            :         else
<span class="lineNum">    1146 </span>            :           return f();
<span class="lineNum">    1147 </span>            :       }
<span class="lineNum">    1148 </span>            : #endif
<span class="lineNum">    1149 </span>            :       
<span class="lineNum">    1150 </span><span class="lineNoCov">          0 :     bool operator!() const BOOST_NOEXCEPT { return !this-&gt;is_initialized() ; }</span>
<span class="lineNum">    1151 </span>            :     
<span class="lineNum">    1152 </span><span class="lineNoCov">          0 :     BOOST_EXPLICIT_OPERATOR_BOOL_NOEXCEPT()</span>
<span class="lineNum">    1153 </span>            : } ;
<span class="lineNum">    1154 </span>            : 
<span class="lineNum">    1155 </span>            : #ifndef  BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
<span class="lineNum">    1156 </span>            : template&lt;class T&gt;
<span class="lineNum">    1157 </span>            : class optional&lt;T&amp;&amp;&gt;
<span class="lineNum">    1158 </span>            : {
<span class="lineNum">    1159 </span>            :   BOOST_STATIC_ASSERT_MSG(sizeof(T) == 0, &quot;Optional rvalue references are illegal.&quot;);
<span class="lineNum">    1160 </span>            : } ;
<span class="lineNum">    1161 </span>            : #endif
<span class="lineNum">    1162 </span>            : 
<span class="lineNum">    1163 </span>            : // Returns optional&lt;T&gt;(v)
<span class="lineNum">    1164 </span>            : template&lt;class T&gt;
<span class="lineNum">    1165 </span>            : inline
<span class="lineNum">    1166 </span>            : optional&lt;T&gt; make_optional ( T const&amp; v  )
<span class="lineNum">    1167 </span>            : {
<span class="lineNum">    1168 </span>            :   return optional&lt;T&gt;(v);
<span class="lineNum">    1169 </span>            : }
<span class="lineNum">    1170 </span>            : 
<span class="lineNum">    1171 </span>            : // Returns optional&lt;T&gt;(cond,v)
<span class="lineNum">    1172 </span>            : template&lt;class T&gt;
<span class="lineNum">    1173 </span>            : inline
<span class="lineNum">    1174 </span>            : optional&lt;T&gt; make_optional ( bool cond, T const&amp; v )
<span class="lineNum">    1175 </span>            : {
<span class="lineNum">    1176 </span>            :   return optional&lt;T&gt;(cond,v);
<span class="lineNum">    1177 </span>            : }
<span class="lineNum">    1178 </span>            : 
<span class="lineNum">    1179 </span>            : // Returns a reference to the value if this is initialized, otherwise, the behaviour is UNDEFINED.
<span class="lineNum">    1180 </span>            : // No-throw
<span class="lineNum">    1181 </span>            : template&lt;class T&gt;
<span class="lineNum">    1182 </span>            : inline
<span class="lineNum">    1183 </span>            : BOOST_DEDUCED_TYPENAME optional&lt;T&gt;::reference_const_type
<span class="lineNum">    1184 </span>            : get ( optional&lt;T&gt; const&amp; opt )
<span class="lineNum">    1185 </span>            : {
<span class="lineNum">    1186 </span>            :   return opt.get() ;
<span class="lineNum">    1187 </span>            : }
<span class="lineNum">    1188 </span>            : 
<span class="lineNum">    1189 </span>            : template&lt;class T&gt;
<span class="lineNum">    1190 </span>            : inline
<span class="lineNum">    1191 </span>            : BOOST_DEDUCED_TYPENAME optional&lt;T&gt;::reference_type
<span class="lineNum">    1192 </span>            : get ( optional&lt;T&gt;&amp; opt )
<span class="lineNum">    1193 </span>            : {
<span class="lineNum">    1194 </span>            :   return opt.get() ;
<span class="lineNum">    1195 </span>            : }
<span class="lineNum">    1196 </span>            : 
<span class="lineNum">    1197 </span>            : // Returns a pointer to the value if this is initialized, otherwise, returns NULL.
<span class="lineNum">    1198 </span>            : // No-throw
<span class="lineNum">    1199 </span>            : template&lt;class T&gt;
<span class="lineNum">    1200 </span>            : inline
<span class="lineNum">    1201 </span>            : BOOST_DEDUCED_TYPENAME optional&lt;T&gt;::pointer_const_type
<span class="lineNum">    1202 </span>            : get ( optional&lt;T&gt; const* opt )
<span class="lineNum">    1203 </span>            : {
<span class="lineNum">    1204 </span>            :   return opt-&gt;get_ptr() ;
<span class="lineNum">    1205 </span>            : }
<span class="lineNum">    1206 </span>            : 
<span class="lineNum">    1207 </span>            : template&lt;class T&gt;
<span class="lineNum">    1208 </span>            : inline
<span class="lineNum">    1209 </span>            : BOOST_DEDUCED_TYPENAME optional&lt;T&gt;::pointer_type
<span class="lineNum">    1210 </span>            : get ( optional&lt;T&gt;* opt )
<span class="lineNum">    1211 </span>            : {
<span class="lineNum">    1212 </span>            :   return opt-&gt;get_ptr() ;
<span class="lineNum">    1213 </span>            : }
<span class="lineNum">    1214 </span>            : 
<span class="lineNum">    1215 </span>            : // Returns a reference to the value if this is initialized, otherwise, the behaviour is UNDEFINED.
<span class="lineNum">    1216 </span>            : // No-throw
<span class="lineNum">    1217 </span>            : template&lt;class T&gt;
<span class="lineNum">    1218 </span>            : inline
<span class="lineNum">    1219 </span>            : BOOST_DEDUCED_TYPENAME optional&lt;T&gt;::reference_const_type
<span class="lineNum">    1220 </span>            : get_optional_value_or ( optional&lt;T&gt; const&amp; opt, BOOST_DEDUCED_TYPENAME optional&lt;T&gt;::reference_const_type v )
<span class="lineNum">    1221 </span>            : {
<span class="lineNum">    1222 </span>            :   return opt.get_value_or(v) ;
<span class="lineNum">    1223 </span>            : }
<span class="lineNum">    1224 </span>            : 
<span class="lineNum">    1225 </span>            : template&lt;class T&gt;
<span class="lineNum">    1226 </span>            : inline
<span class="lineNum">    1227 </span>            : BOOST_DEDUCED_TYPENAME optional&lt;T&gt;::reference_type
<span class="lineNum">    1228 </span>            : get_optional_value_or ( optional&lt;T&gt;&amp; opt, BOOST_DEDUCED_TYPENAME optional&lt;T&gt;::reference_type v )
<span class="lineNum">    1229 </span>            : {
<span class="lineNum">    1230 </span>            :   return opt.get_value_or(v) ;
<span class="lineNum">    1231 </span>            : }
<span class="lineNum">    1232 </span>            : 
<span class="lineNum">    1233 </span>            : // Returns a pointer to the value if this is initialized, otherwise, returns NULL.
<span class="lineNum">    1234 </span>            : // No-throw
<span class="lineNum">    1235 </span>            : template&lt;class T&gt;
<span class="lineNum">    1236 </span>            : inline
<span class="lineNum">    1237 </span>            : BOOST_DEDUCED_TYPENAME optional&lt;T&gt;::pointer_const_type
<span class="lineNum">    1238 </span>            : get_pointer ( optional&lt;T&gt; const&amp; opt )
<span class="lineNum">    1239 </span>            : {
<span class="lineNum">    1240 </span>            :   return opt.get_ptr() ;
<span class="lineNum">    1241 </span>            : }
<span class="lineNum">    1242 </span>            : 
<span class="lineNum">    1243 </span>            : template&lt;class T&gt;
<span class="lineNum">    1244 </span>            : inline
<span class="lineNum">    1245 </span>            : BOOST_DEDUCED_TYPENAME optional&lt;T&gt;::pointer_type
<span class="lineNum">    1246 </span>            : get_pointer ( optional&lt;T&gt;&amp; opt )
<span class="lineNum">    1247 </span>            : {
<span class="lineNum">    1248 </span>            :   return opt.get_ptr() ;
<span class="lineNum">    1249 </span>            : }
<span class="lineNum">    1250 </span>            : 
<span class="lineNum">    1251 </span>            : // The following declaration prevents a bug where operator safe-bool is used upon streaming optional object if you forget the IO header.
<span class="lineNum">    1252 </span>            : template&lt;class CharType, class CharTrait&gt;
<span class="lineNum">    1253 </span>            : std::basic_ostream&lt;CharType, CharTrait&gt;&amp;
<span class="lineNum">    1254 </span>            : operator&lt;&lt;(std::basic_ostream&lt;CharType, CharTrait&gt;&amp; out, optional_detail::optional_tag const&amp; v)
<span class="lineNum">    1255 </span>            : {
<span class="lineNum">    1256 </span>            :   BOOST_STATIC_ASSERT_MSG(sizeof(CharType) == 0, &quot;If you want to output boost::optional, include header &lt;boost/optional/optional_io.hpp&gt;&quot;); 
<span class="lineNum">    1257 </span>            : }
<span class="lineNum">    1258 </span>            : 
<span class="lineNum">    1259 </span>            : // optional's relational operators ( ==, !=, &lt;, &gt;, &lt;=, &gt;= ) have deep-semantics (compare values).
<span class="lineNum">    1260 </span>            : // WARNING: This is UNLIKE pointers. Use equal_pointees()/less_pointess() in generic code instead.
<span class="lineNum">    1261 </span>            : 
<span class="lineNum">    1262 </span>            : 
<span class="lineNum">    1263 </span>            : //
<span class="lineNum">    1264 </span>            : // optional&lt;T&gt; vs optional&lt;T&gt; cases
<span class="lineNum">    1265 </span>            : //
<span class="lineNum">    1266 </span>            : 
<span class="lineNum">    1267 </span>            : template&lt;class T&gt;
<span class="lineNum">    1268 </span>            : inline
<span class="lineNum">    1269 </span>            : bool operator == ( optional&lt;T&gt; const&amp; x, optional&lt;T&gt; const&amp; y )
<span class="lineNum">    1270 </span>            : { return equal_pointees(x,y); }
<span class="lineNum">    1271 </span>            : 
<span class="lineNum">    1272 </span>            : template&lt;class T&gt;
<span class="lineNum">    1273 </span>            : inline
<span class="lineNum">    1274 </span>            : bool operator &lt; ( optional&lt;T&gt; const&amp; x, optional&lt;T&gt; const&amp; y )
<span class="lineNum">    1275 </span>            : { return less_pointees(x,y); }
<span class="lineNum">    1276 </span>            : 
<span class="lineNum">    1277 </span>            : template&lt;class T&gt;
<span class="lineNum">    1278 </span>            : inline
<span class="lineNum">    1279 </span>            : bool operator != ( optional&lt;T&gt; const&amp; x, optional&lt;T&gt; const&amp; y )
<span class="lineNum">    1280 </span>            : { return !( x == y ) ; }
<span class="lineNum">    1281 </span>            : 
<span class="lineNum">    1282 </span>            : template&lt;class T&gt;
<span class="lineNum">    1283 </span>            : inline
<span class="lineNum">    1284 </span>            : bool operator &gt; ( optional&lt;T&gt; const&amp; x, optional&lt;T&gt; const&amp; y )
<span class="lineNum">    1285 </span>            : { return y &lt; x ; }
<span class="lineNum">    1286 </span>            : 
<span class="lineNum">    1287 </span>            : template&lt;class T&gt;
<span class="lineNum">    1288 </span>            : inline
<span class="lineNum">    1289 </span>            : bool operator &lt;= ( optional&lt;T&gt; const&amp; x, optional&lt;T&gt; const&amp; y )
<span class="lineNum">    1290 </span>            : { return !( y &lt; x ) ; }
<span class="lineNum">    1291 </span>            : 
<span class="lineNum">    1292 </span>            : template&lt;class T&gt;
<span class="lineNum">    1293 </span>            : inline
<span class="lineNum">    1294 </span>            : bool operator &gt;= ( optional&lt;T&gt; const&amp; x, optional&lt;T&gt; const&amp; y )
<span class="lineNum">    1295 </span>            : { return !( x &lt; y ) ; }
<span class="lineNum">    1296 </span>            : 
<span class="lineNum">    1297 </span>            : 
<span class="lineNum">    1298 </span>            : //
<span class="lineNum">    1299 </span>            : // optional&lt;T&gt; vs T cases
<span class="lineNum">    1300 </span>            : //
<span class="lineNum">    1301 </span>            : template&lt;class T&gt;
<span class="lineNum">    1302 </span>            : inline
<span class="lineNum">    1303 </span>            : bool operator == ( optional&lt;T&gt; const&amp; x, T const&amp; y )
<span class="lineNum">    1304 </span>            : { return equal_pointees(x, optional&lt;T&gt;(y)); }
<span class="lineNum">    1305 </span>            : 
<span class="lineNum">    1306 </span>            : template&lt;class T&gt;
<span class="lineNum">    1307 </span>            : inline
<span class="lineNum">    1308 </span>            : bool operator &lt; ( optional&lt;T&gt; const&amp; x, T const&amp; y )
<span class="lineNum">    1309 </span>            : { return less_pointees(x, optional&lt;T&gt;(y)); }
<span class="lineNum">    1310 </span>            : 
<span class="lineNum">    1311 </span>            : template&lt;class T&gt;
<span class="lineNum">    1312 </span>            : inline
<span class="lineNum">    1313 </span>            : bool operator != ( optional&lt;T&gt; const&amp; x, T const&amp; y )
<span class="lineNum">    1314 </span>            : { return !( x == y ) ; }
<span class="lineNum">    1315 </span>            : 
<span class="lineNum">    1316 </span>            : template&lt;class T&gt;
<span class="lineNum">    1317 </span>            : inline
<span class="lineNum">    1318 </span>            : bool operator &gt; ( optional&lt;T&gt; const&amp; x, T const&amp; y )
<span class="lineNum">    1319 </span>            : { return y &lt; x ; }
<span class="lineNum">    1320 </span>            : 
<span class="lineNum">    1321 </span>            : template&lt;class T&gt;
<span class="lineNum">    1322 </span>            : inline
<span class="lineNum">    1323 </span>            : bool operator &lt;= ( optional&lt;T&gt; const&amp; x, T const&amp; y )
<span class="lineNum">    1324 </span>            : { return !( y &lt; x ) ; }
<span class="lineNum">    1325 </span>            : 
<span class="lineNum">    1326 </span>            : template&lt;class T&gt;
<span class="lineNum">    1327 </span>            : inline
<span class="lineNum">    1328 </span>            : bool operator &gt;= ( optional&lt;T&gt; const&amp; x, T const&amp; y )
<span class="lineNum">    1329 </span>            : { return !( x &lt; y ) ; }
<span class="lineNum">    1330 </span>            : 
<span class="lineNum">    1331 </span>            : //
<span class="lineNum">    1332 </span>            : // T vs optional&lt;T&gt; cases
<span class="lineNum">    1333 </span>            : //
<span class="lineNum">    1334 </span>            : 
<span class="lineNum">    1335 </span>            : template&lt;class T&gt;
<span class="lineNum">    1336 </span>            : inline
<span class="lineNum">    1337 </span>            : bool operator == ( T const&amp; x, optional&lt;T&gt; const&amp; y )
<span class="lineNum">    1338 </span>            : { return equal_pointees( optional&lt;T&gt;(x), y ); }
<span class="lineNum">    1339 </span>            : 
<span class="lineNum">    1340 </span>            : template&lt;class T&gt;
<span class="lineNum">    1341 </span>            : inline
<span class="lineNum">    1342 </span>            : bool operator &lt; ( T const&amp; x, optional&lt;T&gt; const&amp; y )
<span class="lineNum">    1343 </span>            : { return less_pointees( optional&lt;T&gt;(x), y ); }
<span class="lineNum">    1344 </span>            : 
<span class="lineNum">    1345 </span>            : template&lt;class T&gt;
<span class="lineNum">    1346 </span>            : inline
<span class="lineNum">    1347 </span>            : bool operator != ( T const&amp; x, optional&lt;T&gt; const&amp; y )
<span class="lineNum">    1348 </span>            : { return !( x == y ) ; }
<span class="lineNum">    1349 </span>            : 
<span class="lineNum">    1350 </span>            : template&lt;class T&gt;
<span class="lineNum">    1351 </span>            : inline
<span class="lineNum">    1352 </span>            : bool operator &gt; ( T const&amp; x, optional&lt;T&gt; const&amp; y )
<span class="lineNum">    1353 </span>            : { return y &lt; x ; }
<span class="lineNum">    1354 </span>            : 
<span class="lineNum">    1355 </span>            : template&lt;class T&gt;
<span class="lineNum">    1356 </span>            : inline
<span class="lineNum">    1357 </span>            : bool operator &lt;= ( T const&amp; x, optional&lt;T&gt; const&amp; y )
<span class="lineNum">    1358 </span>            : { return !( y &lt; x ) ; }
<span class="lineNum">    1359 </span>            : 
<span class="lineNum">    1360 </span>            : template&lt;class T&gt;
<span class="lineNum">    1361 </span>            : inline
<span class="lineNum">    1362 </span>            : bool operator &gt;= ( T const&amp; x, optional&lt;T&gt; const&amp; y )
<span class="lineNum">    1363 </span>            : { return !( x &lt; y ) ; }
<span class="lineNum">    1364 </span>            : 
<span class="lineNum">    1365 </span>            : 
<span class="lineNum">    1366 </span>            : //
<span class="lineNum">    1367 </span>            : // optional&lt;T&gt; vs none cases
<span class="lineNum">    1368 </span>            : //
<span class="lineNum">    1369 </span>            : 
<span class="lineNum">    1370 </span>            : template&lt;class T&gt;
<span class="lineNum">    1371 </span>            : inline
<span class="lineNum">    1372 </span>            : bool operator == ( optional&lt;T&gt; const&amp; x, none_t ) BOOST_NOEXCEPT
<span class="lineNum">    1373 </span>            : { return !x; }
<span class="lineNum">    1374 </span>            : 
<span class="lineNum">    1375 </span>            : template&lt;class T&gt;
<span class="lineNum">    1376 </span>            : inline
<span class="lineNum">    1377 </span>            : bool operator &lt; ( optional&lt;T&gt; const&amp; x, none_t )
<span class="lineNum">    1378 </span>            : { return less_pointees(x,optional&lt;T&gt;() ); }
<span class="lineNum">    1379 </span>            : 
<span class="lineNum">    1380 </span>            : template&lt;class T&gt;
<span class="lineNum">    1381 </span>            : inline
<span class="lineNum">    1382 </span>            : bool operator != ( optional&lt;T&gt; const&amp; x, none_t ) BOOST_NOEXCEPT
<span class="lineNum">    1383 </span>            : { return bool(x); }
<span class="lineNum">    1384 </span>            : 
<span class="lineNum">    1385 </span>            : template&lt;class T&gt;
<span class="lineNum">    1386 </span>            : inline
<span class="lineNum">    1387 </span>            : bool operator &gt; ( optional&lt;T&gt; const&amp; x, none_t y )
<span class="lineNum">    1388 </span>            : { return y &lt; x ; }
<span class="lineNum">    1389 </span>            : 
<span class="lineNum">    1390 </span>            : template&lt;class T&gt;
<span class="lineNum">    1391 </span>            : inline
<span class="lineNum">    1392 </span>            : bool operator &lt;= ( optional&lt;T&gt; const&amp; x, none_t y )
<span class="lineNum">    1393 </span>            : { return !( y &lt; x ) ; }
<span class="lineNum">    1394 </span>            : 
<span class="lineNum">    1395 </span>            : template&lt;class T&gt;
<span class="lineNum">    1396 </span>            : inline
<span class="lineNum">    1397 </span>            : bool operator &gt;= ( optional&lt;T&gt; const&amp; x, none_t y )
<span class="lineNum">    1398 </span>            : { return !( x &lt; y ) ; }
<span class="lineNum">    1399 </span>            : 
<span class="lineNum">    1400 </span>            : //
<span class="lineNum">    1401 </span>            : // none vs optional&lt;T&gt; cases
<span class="lineNum">    1402 </span>            : //
<span class="lineNum">    1403 </span>            : 
<span class="lineNum">    1404 </span>            : template&lt;class T&gt;
<span class="lineNum">    1405 </span>            : inline
<span class="lineNum">    1406 </span>            : bool operator == ( none_t , optional&lt;T&gt; const&amp; y ) BOOST_NOEXCEPT
<span class="lineNum">    1407 </span>            : { return !y; }
<span class="lineNum">    1408 </span>            : 
<span class="lineNum">    1409 </span>            : template&lt;class T&gt;
<span class="lineNum">    1410 </span>            : inline
<span class="lineNum">    1411 </span>            : bool operator &lt; ( none_t , optional&lt;T&gt; const&amp; y )
<span class="lineNum">    1412 </span>            : { return less_pointees(optional&lt;T&gt;() ,y); }
<span class="lineNum">    1413 </span>            : 
<span class="lineNum">    1414 </span>            : template&lt;class T&gt;
<span class="lineNum">    1415 </span>            : inline
<span class="lineNum">    1416 </span>            : bool operator != ( none_t, optional&lt;T&gt; const&amp; y ) BOOST_NOEXCEPT
<span class="lineNum">    1417 </span>            : { return bool(y); }
<span class="lineNum">    1418 </span>            : 
<span class="lineNum">    1419 </span>            : template&lt;class T&gt;
<span class="lineNum">    1420 </span>            : inline
<span class="lineNum">    1421 </span>            : bool operator &gt; ( none_t x, optional&lt;T&gt; const&amp; y )
<span class="lineNum">    1422 </span>            : { return y &lt; x ; }
<span class="lineNum">    1423 </span>            : 
<span class="lineNum">    1424 </span>            : template&lt;class T&gt;
<span class="lineNum">    1425 </span>            : inline
<span class="lineNum">    1426 </span>            : bool operator &lt;= ( none_t x, optional&lt;T&gt; const&amp; y )
<span class="lineNum">    1427 </span>            : { return !( y &lt; x ) ; }
<span class="lineNum">    1428 </span>            : 
<span class="lineNum">    1429 </span>            : template&lt;class T&gt;
<span class="lineNum">    1430 </span>            : inline
<span class="lineNum">    1431 </span>            : bool operator &gt;= ( none_t x, optional&lt;T&gt; const&amp; y )
<span class="lineNum">    1432 </span>            : { return !( x &lt; y ) ; }
<span class="lineNum">    1433 </span>            : 
<span class="lineNum">    1434 </span>            : namespace optional_detail {
<span class="lineNum">    1435 </span>            : 
<span class="lineNum">    1436 </span>            : template&lt;bool use_default_constructor&gt; struct swap_selector;
<span class="lineNum">    1437 </span>            : 
<span class="lineNum">    1438 </span>            : template&lt;&gt;
<span class="lineNum">    1439 </span>            : struct swap_selector&lt;true&gt;
<span class="lineNum">    1440 </span>            : {
<span class="lineNum">    1441 </span>            :     template&lt;class T&gt;
<span class="lineNum">    1442 </span>            :     static void optional_swap ( optional&lt;T&gt;&amp; x, optional&lt;T&gt;&amp; y )
<span class="lineNum">    1443 </span>            :     {
<span class="lineNum">    1444 </span>            :         const bool hasX = !!x;
<span class="lineNum">    1445 </span>            :         const bool hasY = !!y;
<span class="lineNum">    1446 </span>            : 
<span class="lineNum">    1447 </span>            :         if ( !hasX &amp;&amp; !hasY )
<span class="lineNum">    1448 </span>            :             return;
<span class="lineNum">    1449 </span>            : 
<span class="lineNum">    1450 </span>            :         if( !hasX )
<span class="lineNum">    1451 </span>            :             x = boost::in_place();
<span class="lineNum">    1452 </span>            :         else if ( !hasY )
<span class="lineNum">    1453 </span>            :             y = boost::in_place();
<span class="lineNum">    1454 </span>            : 
<span class="lineNum">    1455 </span>            :         // Boost.Utility.Swap will take care of ADL and workarounds for broken compilers
<span class="lineNum">    1456 </span>            :         boost::swap(x.get(),y.get());
<span class="lineNum">    1457 </span>            : 
<span class="lineNum">    1458 </span>            :         if( !hasX )
<span class="lineNum">    1459 </span>            :             y = boost::none ;
<span class="lineNum">    1460 </span>            :         else if( !hasY )
<span class="lineNum">    1461 </span>            :             x = boost::none ;
<span class="lineNum">    1462 </span>            :     }
<span class="lineNum">    1463 </span>            : };
<span class="lineNum">    1464 </span>            : 
<span class="lineNum">    1465 </span>            : #ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
<span class="lineNum">    1466 </span>            : template&lt;&gt;
<span class="lineNum">    1467 </span>            : struct swap_selector&lt;false&gt;
<span class="lineNum">    1468 </span>            : {
<span class="lineNum">    1469 </span>            :     template&lt;class T&gt;
<span class="lineNum">    1470 </span>            :     static void optional_swap ( optional&lt;T&gt;&amp; x, optional&lt;T&gt;&amp; y ) 
<span class="lineNum">    1471 </span>            :     //BOOST_NOEXCEPT_IF(::boost::is_nothrow_move_constructible&lt;T&gt;::value &amp;&amp; BOOST_NOEXCEPT_EXPR(boost::swap(*x, *y)))
<span class="lineNum">    1472 </span>            :     {
<span class="lineNum">    1473 </span>            :         if(x)
<span class="lineNum">    1474 </span>            :         {
<span class="lineNum">    1475 </span>            :             if (y)
<span class="lineNum">    1476 </span>            :             {
<span class="lineNum">    1477 </span>            :                 boost::swap(*x, *y);
<span class="lineNum">    1478 </span>            :             }
<span class="lineNum">    1479 </span>            :             else
<span class="lineNum">    1480 </span>            :             {
<span class="lineNum">    1481 </span>            :                 y = boost::move(*x);
<span class="lineNum">    1482 </span>            :                 x = boost::none;
<span class="lineNum">    1483 </span>            :             }
<span class="lineNum">    1484 </span>            :         }
<span class="lineNum">    1485 </span>            :         else
<span class="lineNum">    1486 </span>            :         {
<span class="lineNum">    1487 </span>            :             if (y)
<span class="lineNum">    1488 </span>            :             {
<span class="lineNum">    1489 </span>            :                 x = boost::move(*y);
<span class="lineNum">    1490 </span>            :                 y = boost::none;
<span class="lineNum">    1491 </span>            :             }
<span class="lineNum">    1492 </span>            :         }
<span class="lineNum">    1493 </span>            :     }
<span class="lineNum">    1494 </span>            : };
<span class="lineNum">    1495 </span>            : #else
<span class="lineNum">    1496 </span>            : template&lt;&gt;
<span class="lineNum">    1497 </span>            : struct swap_selector&lt;false&gt;
<span class="lineNum">    1498 </span>            : {
<span class="lineNum">    1499 </span>            :     template&lt;class T&gt;
<span class="lineNum">    1500 </span>            :     static void optional_swap ( optional&lt;T&gt;&amp; x, optional&lt;T&gt;&amp; y )
<span class="lineNum">    1501 </span>            :     {
<span class="lineNum">    1502 </span>            :         const bool hasX = !!x;
<span class="lineNum">    1503 </span>            :         const bool hasY = !!y;
<span class="lineNum">    1504 </span>            : 
<span class="lineNum">    1505 </span>            :         if ( !hasX &amp;&amp; hasY )
<span class="lineNum">    1506 </span>            :         {
<span class="lineNum">    1507 </span>            :             x = y.get();
<span class="lineNum">    1508 </span>            :             y = boost::none ;
<span class="lineNum">    1509 </span>            :         }
<span class="lineNum">    1510 </span>            :         else if ( hasX &amp;&amp; !hasY )
<span class="lineNum">    1511 </span>            :         {
<span class="lineNum">    1512 </span>            :             y = x.get();
<span class="lineNum">    1513 </span>            :             x = boost::none ;
<span class="lineNum">    1514 </span>            :         }
<span class="lineNum">    1515 </span>            :         else if ( hasX &amp;&amp; hasY )
<span class="lineNum">    1516 </span>            :         {
<span class="lineNum">    1517 </span>            :             // Boost.Utility.Swap will take care of ADL and workarounds for broken compilers
<span class="lineNum">    1518 </span>            :             boost::swap(x.get(),y.get());
<span class="lineNum">    1519 </span>            :         }
<span class="lineNum">    1520 </span>            :     }
<span class="lineNum">    1521 </span>            : };
<span class="lineNum">    1522 </span>            : #endif // !defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
<span class="lineNum">    1523 </span>            : 
<span class="lineNum">    1524 </span>            : } // namespace optional_detail
<span class="lineNum">    1525 </span>            : 
<span class="lineNum">    1526 </span>            : template&lt;class T&gt;
<span class="lineNum">    1527 </span>            : struct optional_swap_should_use_default_constructor : has_nothrow_default_constructor&lt;T&gt; {} ;
<span class="lineNum">    1528 </span>            : 
<span class="lineNum">    1529 </span>            : template&lt;class T&gt; inline void swap ( optional&lt;T&gt;&amp; x, optional&lt;T&gt;&amp; y )
<span class="lineNum">    1530 </span>            :   //BOOST_NOEXCEPT_IF(::boost::is_nothrow_move_constructible&lt;T&gt;::value &amp;&amp; BOOST_NOEXCEPT_EXPR(boost::swap(*x, *y)))
<span class="lineNum">    1531 </span>            : {
<span class="lineNum">    1532 </span>            :     optional_detail::swap_selector&lt;optional_swap_should_use_default_constructor&lt;T&gt;::value&gt;::optional_swap(x, y);
<span class="lineNum">    1533 </span>            : }
<span class="lineNum">    1534 </span>            : 
<span class="lineNum">    1535 </span>            : } // namespace boost
<span class="lineNum">    1536 </span>            : 
<span class="lineNum">    1537 </span>            : #endif
</pre>
      </td>
    </tr>
  </table>
  <br>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="ruler"><img src="../../../../glass.png" width=3 height=3 alt=""></td></tr>
    <tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php" target="_parent">LCOV version 1.12</a></td></tr>
  </table>
  <br>

</body>
</html>
